ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1104. Не спрашивай даму о возрасте

This is my program.What is the problem with my program?Please tell me.
Thank you!
#include<iostream.h>
#include<string.h>
#include<stdlib.h>
char* str;
int f(char* s){
  char max='0';

  for(long  lop=0;s[lop]!='\0';lop++)
      if(s[lop]>max)max=s[lop];
      if(max<'2')return 2;
      if(max<='9')return int(max-'0'+1);
      return int(max-'A'+11);
      }
int num(char s){
     if(s<='9')return int(s-'0');
     return int(s-'A'+10);
     }

void main(){
 str=new char[950010];
 cin>>str;
 long l;
 for(l=0;str[l]!='\0';l++)if(l>=950010)exit(1);
 int lop;
 unsigned long h;
 unsigned long temp;
 for(int k=f(str);k<=36;k++)
 {
     temp=0;
     h=0;
   int y=l%5;
   if(y!=0)
      for(lop=0;lop<y;lop++)
    {
    temp=temp*k;
    temp+=num(str[h]);
    h++;
        if(h==l) break;
    }
    while(h!=l)
      {
    temp=temp%(k-1);
    for(lop=0;lop<5;lop++)
      {
        temp=temp*k;
        temp+=num(str[h]);
        h++;
            if (h==l) break;
      }
      }
    if(temp%(k-1)==0){cout<<k<<endl;exit(1);}
 }
cout<<"No solution."<<endl;
}
it needn't keep all number in array
if u know
 (m+n)%k = ((m%k)+(n%k))%k
> it needn't keep all number in array
> if u know
>  (m+n)%k = ((m%k)+(n%k))%k