## Search found 7 matches

Mon Jan 06, 2014 8:13 pm
Forum: Volume 118 (11800-11899)
Topic: 11838 - Come and Go
Replies: 22
Views: 7207

### Re: 11838 - Come And Go

I used Tarjan's SCC Algorithm to find the number of SCC in the given graph. The answer is 1 if number of SCC is 1, else the answer is 0. Now this gives WA and I can't find why. So please help me. This is the first time I'm doing SCC. #include <bits/stdc++.h> using namespace std; #ifdef __GNUC__ type...
Mon Apr 15, 2013 12:54 am
Forum: Volume 100 (10000-10099)
Topic: 10018 - Reverse and Add
Replies: 169
Views: 16697

### Re: 10018 - Reverse and Add

Why WA? my code seems to give correct output for all possible input. #include <stdio.h> #include <string.h> int pal_check(char *s) { int len=strlen(s),i; for(i=0;i<len/2;i++) if(s[i]!=s[len-i-1]) return 0; return 1; } char *rev_add(char *s1, int len) { char x[1000],s2[1000]; int i,j,tmp,carry=0; for...
Tue Mar 19, 2013 5:39 pm
Forum: Volume 109 (10900-10999)
Replies: 80
Views: 27205

### Re: 10954 - Add All

#include <stdio.h> #include <string.h> void sort(long long int array[], long long int length) { long long int i,j,count,pos,min[10000][2]; for(i=0;i<length;i++) { min[i][1]=0; } for(i=0;i<length;i++) { count=0; for(j=0;j<length;j++) { if(array[i]<array[j]) count++; } pos=++min[count][1]; min[count+...
Mon Mar 11, 2013 5:27 pm
Forum: Volume 109 (10900-10999)
Topic: 10921 - Find the Telephone
Replies: 23
Views: 7846

### Re: 10921 - Find the Telephone

why do I have to read one character at a time? what's wrong with my current code?
Fri Mar 08, 2013 4:46 pm
Forum: Volume 109 (10900-10999)
Topic: 10921 - Find the Telephone
Replies: 23
Views: 7846

### Re: 10921 - Find the Telephone

Why do I get WA for this? #include <stdio.h> #include <string.h> int main() { char s[32767]; int i,j,k,l,len; while(scanf("%s",s)!=EOF) { len=strlen(s); for(i=0;i<len;i++) { if(s[i]>=65 && s[i]<68) s[i]='2'; else if(s[i]>=68 && s[i]<71) s[i]='3'; else if(s[i]>=71 && s[i]<74) s[i]='4'; else if(s[i]>=...
Mon Mar 04, 2013 12:32 pm
Forum: Volume 100 (10000-10099)
Topic: 10035 - Primary Arithmetic
Replies: 328
Views: 55497

### Re: 10035 - Primary Arithmetic

Thank you very much. got AC!
Sat Mar 02, 2013 11:16 pm
Forum: Volume 100 (10000-10099)
Topic: 10035 - Primary Arithmetic
Replies: 328
Views: 55497

### Re: 10035 - Primary Arithmetic

I tried every single I/O on this forum and got correct for all of them with the following code, which by the way gets WA. #include <stdio.h> #include <string.h> int main() { char num1[32767], num2[32767]; int i,j,count,l,min,x,y; int sum; while(scanf("%s %s", num1, num2)==2 && !(num1[0]=='0' && num1...