Search found 6 matches

by sharath
Thu Jul 30, 2009 1:17 pm
Forum: Volume 116 (11600-11699)
Topic: 11609 - Teams
Replies: 11
Views: 5254

11609 - Teams

The problem says that output has to be printed result modulo 1000000007, I dont understand why this value and moreover for n=3, the number of ways the coach can choose his team is: First for k = 1, He has 3 ways, for k = 2, He has 6 * 2 (For different captains) ways, for k = 3, He has 1 * 3 (For dif...
by sharath
Wed Jul 08, 2009 7:49 am
Forum: Volume 113 (11300-11399)
Topic: 11349 - Symmetric Matrix
Replies: 43
Views: 19203

Re: 11349 - Symmetric Matrix

Surprisingly executing the same code in my windows XP PC gives the proper output and I think it is because of fflush(stdin) statement which is platform dependent. So for the platforms not supporting fflush (stdin) the input logic fails and hence the code. Thanks for pointing it out, I changed the in...
by sharath
Tue Jul 07, 2009 11:05 am
Forum: Volume 113 (11300-11399)
Topic: 11349 - Symmetric Matrix
Replies: 43
Views: 19203

Re: 11349 - Symmetric Matrix

@kbr_iut :
I have used fflush(stdin) before the statement scanf ("%c %c %d", &junk, &junk, &n); So the new line character would be flushed and n will have the value 3 for the input you have mentioned. Am I correct?
by sharath
Tue Jun 30, 2009 12:56 pm
Forum: Volume 113 (11300-11399)
Topic: 11349 - Symmetric Matrix
Replies: 43
Views: 19203

Re: 11349 - Symmetric Matrix

#include <stdio.h> int main () { int num_test, k, n, i, j, flag; long long a[110][110]; char junk; scanf ("%d", &num_test); k = 0; NEXT_CASE: while (k++ < num_test) { fflush (stdin); scanf ("%c %c %d", &junk, &junk, &n); flag = 0; for (i = 0;i < n; i ++) { for (j = 0;j < n;j ++) { scanf("%lld", &a [...
by sharath
Thu Jun 11, 2009 7:52 am
Forum: Volume 112 (11200-11299)
Topic: 11219 - How old are you?
Replies: 117
Views: 33591

Re: 11219 - How old are you?

#include <stdio.h> int main () { int num_test, i, td_date, td_mnth, td_year; int bd_date, bd_mnth, bd_year, days; scanf ("%d", &num_test); for (i = 1; i <= num_test; i ++) { scanf ("%d/%d/%d", &td_date, &td_mnth, &td_year); scanf ("%d/%d/%d", &bd_date, &bd_mnth, &bd_year); days = (td_year - bd_year)...
by sharath
Tue Sep 16, 2008 9:24 pm
Forum: Volume 109 (10900-10999)
Topic: 10928 - My Dear Neighbours
Replies: 13
Views: 8046

Re: 10928 - My Dear Neighbours

My code below is passing all the test cases mentioned in the thread but getting WA when submitted.. #include <iostream> #include <string> #include <sstream> using namespace std; int a[1000]; int main() { int n,p,d,i,min; char str[1000]; cin>>n; while (n-- != 0) { i = 0; cin>>p; min = p-1; memset(a,0...

Go to advanced search