Search found 12 matches

by Stummer
Mon Sep 18, 2006 9:30 am
Forum: Volume 110 (11000-11099)
Topic: 11087 - Divisibility Testing
Replies: 36
Views: 18093

Sumon wrote: Sample Input:

5
5 5
5 5 5 5 5
4 4
2 2 4 0
3 4
2 2 4
5 4
2 2 4 0 4
5 4
-1 3 -3 1 1

Sample Output

Case 1: 1
Case 2: 2
Case 3: 1
Case 4: 3
Case 5: 4
Thanks, but my program outputs the same output.
by Stummer
Sun Sep 17, 2006 3:40 pm
Forum: Volume 110 (11000-11099)
Topic: 11087 - Divisibility Testing
Replies: 36
Views: 18093

I don't need initialize it with 0's, because I use different flags for each test case, i. e. I use flags 1 and 2 for test case 1, 3 and 4 for test case 2 and so... I changed char[20000005] to unsigned char[20000005] but got WA again :( In my implementation, at the end of each test case i have reset...
by Stummer
Sat Sep 16, 2006 4:27 pm
Forum: Volume 101 (10100-10199)
Topic: 10198 - Counting
Replies: 30
Views: 14351

Please i got wrong answer I just need sample inputs and sample outputs for 3 4 5 6 7 8 9 100 200 1000 and more if any one can This is my program, and it gets RTE on online judge, but it works on my computer normally. #include <iostream.h> int m[1005][500]={0}; int main() { int i,n,j,t; m[0][499]=1;...
by Stummer
Sat Sep 16, 2006 1:35 pm
Forum: Volume 110 (11000-11099)
Topic: 11087 - Divisibility Testing
Replies: 36
Views: 18093

make the flag array ready for the next input. re - initialize it with 0's I don't need initialize it with 0's, because I use different flags for each test case, i. e. I use flags 1 and 2 for test case 1, 3 and 4 for test case 2 and so... I changed char[20000005] to unsigned char[20000005] but got W...
by Stummer
Wed Sep 13, 2006 10:02 am
Forum: Volume 110 (11000-11099)
Topic: 11087 - Divisibility Testing
Replies: 36
Views: 18093

No sorting & no hashing. I used a flag array to identify duplicates.. char flag[20000002] It runs within 0:07.125 I used that method and got WA :cry: #include <iostream.h> #include <string.h> char flag[20000005]={0}; const int dif=10000005; int main() { long long s,temp,k,t,n,ii,i,zz,zibil; cin>>t;...
by Stummer
Thu Sep 07, 2006 2:47 pm
Forum: Volume 110 (11000-11099)
Topic: 11077 - Find the Permutations
Replies: 14
Views: 7092

[quote="minskcity] number of permutations which will take at least K swaps should be number of permutations for which minimum number of swaps to sort is K "at least" implies nothing about minimum. Are you claiming that "1 3 2" does not require "at least 0 swaps" to sort it? Let me know how to sort i...
by Stummer
Wed Sep 06, 2006 2:53 pm
Forum: Volume 110 (11000-11099)
Topic: 11077 - Find the Permutations
Replies: 14
Views: 7092

From problem statement, output section: For each of the input, print in a line the number of permutations which will take at least K swaps. Now, look at the test case#2... The way I see it, any of 3! = 6 permutations of 3 elements require at least 0 swaps to sort. You should output the number of pe...
by Stummer
Sun Jul 23, 2006 1:31 pm
Forum: Volume 1 (100-199)
Topic: 128 - Software CRC
Replies: 62
Views: 7489

Thanks a lot, Zaspire, but I am getting WA :cry: This is my code: #include <iostream.h> #include <stdio.h> int main() { char c; int crc,m=34943; for(;;) { c=getchar(); if(c=='#') break; crc=0; while(c!='\n') { crc<<=8; crc+=c; crc%=34943; c=getchar(); } crc=(crc<<16)%34943; if(crc) crc=34943-crc; pr...
by Stummer
Thu Jul 06, 2006 9:58 am
Forum: Volume 1 (100-199)
Topic: 128 - Software CRC
Replies: 62
Views: 7489

Need Help. Problem 128

What's the formula for this problem?
by Stummer
Wed Jul 05, 2006 12:09 pm
Forum: Volume 106 (10600-10699)
Topic: 10656 - Maximum Sum (II)
Replies: 52
Views: 16255

Thanks to Adrian Kuegel :wink: !!! At last I got Accepted!
by Stummer
Sat Jul 01, 2006 12:59 pm
Forum: Volume 103 (10300-10399)
Topic: 10324 - Zeros and Ones
Replies: 179
Views: 43578

Re: 10324 Help me ! or i will DIE

At least I got Accepted! :wink: Here is my code: #include <iostream> #include <cstdio> #include <string> using namespace std; char c[1000005]; int m[1000005]; int main() { int n,a,b,i,ii=0,k; while(scanf("%s",c)!=EOF) { ii++; cout<<"Case "<<ii<<':'<<endl; m[0]=0; k=strlen(c); for(i=1;i<k;i++) { if(c...
by Stummer
Sat Jul 01, 2006 12:55 pm
Forum: Volume 103 (10300-10399)
Topic: 10324 - Zeros and Ones
Replies: 179
Views: 43578

Re: 10324 Help me ! or i will DIE

Why I got TLE?? :cry: #include <iostream> #include <cstdio> #include <string> using namespace std; char c[1000005]; int m[1000005]; int main() { int n,a,b,i,ii=0; while(scanf("%s",c)!=EOF) { ii++; cout<<"Case "<<ii<<':'<<endl; m[0]=0; for(i=1;i<strlen(c);i++) { if(c !=c[i-1]) m =m[i-1]+1; else m =m[...

Go to advanced search