|
|
Common BoardDo you have the same problem ??? This porblem has not correct test's again.For example, if always output something like printf("700000\n"); you'll get accepted. 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 Give me some tests, please !!! And i hope you'll help me !!! VRomanchik@mailru.com Hi All! Sorry for been msiiing for long time - I had no home Internet so could do nothing. About lost staistics: we have some technical problems and make a redjudging. Wayt a couple of days. About server being down for long time - we were out of electricity :)) It seems funny, but It is a reality :)) Other problems - I will be missing for a month till September 1st. I will try to do my best to answer your questions and make all ok when I come back from my vacation. Good luck all! Marat Bakirov. 1 begin end. 2 begin just printf the example.... end. My program is here: var m,n,k:longint; min:longint; function nums(a:longint):longint; var i,tot:longint; begin tot:=0; for i:=1 to trunc(sqrt(a)) do if a mod i=0 then inc(tot); nums:=tot; end; begin readln(m,n,k); for min:=1 to 10000 do begin if (nums(min)=n)and(nums(min-k)=m) then begin writeln(min); exit; end; end; writeln(0); end. min should be not less than k or ur program'll get crash because it try to find square root of an negative integer :) #include <stdio.h> #include <math.h> int i,m,n,k; int num(int num) { int i,tot=0; for (i=1; i<=(int)sqrt(num); ++i) if (num%i==0) ++tot; return tot; } int main() { scanf("%d%d%d",&m,&n,&k); for (i=k; i<10000; ++i) if ((num(i)==n)&&(num(i-k)==m)) { printf("%d",i); exit(0); } printf("%d",0); return 0; } #include<iostream.h> #include<string.h> #define MAX 2000 int srav(int a[MAX+100],int b[MAX+100]); int sqr(); int pr[MAX+100],result[MAX+100]; void main(){ char str[MAX+100]; int t,j,p[MAX+100],q[MAX+100],mass[MAX+100]; for(int i=0;i<MAX;i++) { mass[i]=0; str[i]=0; p[i]=0; q[i]=0; } cin >> str; //for(i=MAX-1;i>=0;i--) // if(str[i]) int pm=strlen(str); if((pm==1)&&(str[0]=='0')) { cout << 0; return ; } for(i=0;i<pm;i++) mass[i]=int(str[pm-i-1])-48; int l=0; for(i=0;i<MAX;i++) { t=mass[i]; mass[i]=(t*2+l)%10; l=(t*2+l)/10; } for(i=MAX-1;i>=0;i--) if(mass[i]!=0) { pm=i+1; break; } q[pm/2+1]=1; while(srav(p,q)==1) { for(i=MAX-1;i>=0;i--) pr[i]=0; l=0; for(i=0;i<MAX;i++) { pr[i]=(p[i]+q[i]+l)%10; l=(p[i]+q[i]+l)/10; } for(i=MAX-1;i>=0;i--) if(pr[i]!=0) { for(j=i;j>0;j--) { if(pr[j]%2!=0) pr[j-1]+=10; pr[j]/=2; } pr[0]/=2; break; } l=sqr(); if(l>pm) for(i=0;i<MAX;i++) q[i]=pr[i]; if(l<pm) for(i=0;i<MAX;i++) p[i]=pr[i]; if(l==pm) { if(srav(result,mass)==1) for(i=0;i<MAX;i++) p[i]=pr[i]; if(srav(result,mass)==0) break; if(srav(result,mass)==-1) for(i=0;i<MAX;i++) q[i]=pr[i]; } } for(i=MAX-1;i>=0;i--) if(pr[i]!=0) { for(j=i;j>=0;j--) cout << pr[j]; break; } } int srav(int a[MAX],int b[MAX]){ for(int i=MAX-1;i>=0;i--) { if(a[i]<b[i]) return 1; if(a[i]>b[i]) return -1; } return 0; } int sqr(){ int l,i,j,t; for(i=MAX-1;i>=0;i--) if(pr[i]!=0) { l=i+1; break; } for(i=MAX-1;i>=0;i--) result[i]=0; for(i=0;i<l;i++) for(j=0;j<l;j++) if(i+j<MAX-5) { t=pr[i]*pr[j]; result[i+j]+=t; } else return MAX+200; l=0; for(i=0;i<MAX-1;i++) { t=result[i]; result[i]=(result[i]+l)%10; l=(t+l)/10; } if(l!=0) return MAX+200; l=0; for(i=0;i<MAX;i++) { t=result[i]; result[i]=(l+result[i]+pr[i])%10; l=(l+t+pr[i])/10; } if(l!=0) return MAX+200; for(i=MAX-1;i>=0;i--) if(result[i]!=0) return i+1; return 0; } Your testers aren't OK. f.e. This solution is ACC: #include <iostream.h> int a; int main() { cin >> a; return 0; } And this got CRASH: int main() { return 0; } All codes in C++. I've tried to submit problem 1190. This got restricted function: var N:Integer; procedure Inp; begin ReadLn(N); end; procedure SkipName; var C:Char; begin C:=#0; while C<>' ' do Read(C); end; procedure Run; var I, B, W, C:LongInt; TV:LongInt; All:Boolean; begin C:=0; TV:=0; All:=True; for I:=1 to N do begin SkipName; Read(B); if (B<>0) then begin Read(W); TV:=TV+W*(C+1); C:=0; end else begin Inc(C); All:=False; end; end; TV:=TV+C; if (TV>10000) or ((All) and (TV<>10000)) then WriteLn('NO') else WriteLn('YES'); end; procedure Out; begin end; begin Inp; Run; Out; end. ------------------------- And this got accepted: begin WriteLn('NO'); end. I submited a solution and I got CRASH so I submited this code (C++) #include <iostream.h> int main() { return 0; } and I got... CRASH Something's wrong Command line error D2027 : cannot execute 'E:\Judge\VC\link.exe' This problem is straightforward. I submitted my solution and it was wrong answer, so did a friend of mine. Then I submitted solution which was accepted some time ago and it was Wrong answer again. So I'm kind of wondering what's going on with this prob. Petko Minkov program p_1006; begin writeln (6); end. |
|
|