Search found 2 matches

by rafikamal
Thu Jan 31, 2013 11:07 am
Forum: Volume 100 (10000-10099)
Topic: 10054 - The Necklace
Replies: 62
Views: 31276

Re: 10054 - The Necklace

My program passes the sample test cases and all the test cases from this forum, but I'm continuously getting WA. list<int> edges[SIZE]; list<int> beads; void tour(int node) { stack<int> nodesToBeVisited; nodesToBeVisited.push(node); while(!nodesToBeVisited.empty()) { node = nodesToBeVisited.top(); n...
by rafikamal
Sat Nov 26, 2011 11:13 am
Forum: Volume 3 (300-399)
Topic: 382 - Perfection
Replies: 95
Views: 19163

382 Why wrong ans?

This program runs on my PC nicely and gives desired output but shows WA when submitted: #include <stdio.h> int main() { int i,sum,n; printf("PERFECTION OUTPUT\n"); while(1) { scanf("%d",&n); if(!n) break; sum=1; for(i=2;i<=n/2;i++) if(!(n%i)) sum+=i; if(sum==n) printf("%5d PERFECT\n",n); else if(sum...

Go to advanced search