You are forgetting that sometimes the people who overpay need to give back more money than what the people who pay less need to receive. Like for example:
4 people, one pays $25.03, the other all pay $25. The average is $25.0075. Now all the people who pay less are within one cent, so your ...
Search found 5 matches
- Wed Feb 27, 2013 1:53 pm
- Forum: Volume 101 (10100-10199)
- Topic: 10137 - The Trip
- Replies: 159
- Views: 70791
- Fri Jul 01, 2011 9:17 am
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 320261
Re: If you get WA in problem 100, read me before post!
I write it in C.
Can anyone help me with this?
WA
#include<stdio.h>
#include<stdlib.h>
int howlong(int q)
{ int a;
a=0;
qwe:
if(q==1)
{goto asd;
}
else if(q%2==1)
{q=3*q+1;
}
else
{q=q/2;
}
a++;
goto qwe;
asd:
a++;
return a;
}
main()
{
int a,b,c,i,j;
scanf("%d %d",&i ...
Can anyone help me with this?
WA
#include<stdio.h>
#include<stdlib.h>
int howlong(int q)
{ int a;
a=0;
qwe:
if(q==1)
{goto asd;
}
else if(q%2==1)
{q=3*q+1;
}
else
{q=q/2;
}
a++;
goto qwe;
asd:
a++;
return a;
}
main()
{
int a,b,c,i,j;
scanf("%d %d",&i ...
- Mon Jun 06, 2011 12:05 pm
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 320261
Re: If you get WA in problem 100, read me before post!
Found the problem in my code. Everything was correct except that end of line marker (endl). I just included and submitted. It worked like a charm. 
Silly mistake but took two days for me to spot...

Silly mistake but took two days for me to spot...

- Sun Jun 05, 2011 6:18 am
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 320261
Re: If you get WA in problem 100, read me before post!
Hi Black Hat,
1) Has your program run fine with the sample inputs and outputs provided?
2) And if that works fine, please try and execute your program with the following input "1 1000000". (I mean to say, you need to optimize the program) :)
Would you tell me please whats wrong in this code? I ...
1) Has your program run fine with the sample inputs and outputs provided?
2) And if that works fine, please try and execute your program with the following input "1 1000000". (I mean to say, you need to optimize the program) :)
Would you tell me please whats wrong in this code? I ...
- Sun Jun 05, 2011 6:14 am
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 320261
Re: If you get WA in problem 100, read me before post!
/*
TASK: 3n+1
LANG: C++
AUTHOR: thefourtheye
*/
#include <vector>
#include <fstream>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include ...