Search found 4 matches

by Scorvus
Thu Sep 26, 2013 5:14 pm
Forum: Volume 106 (10600-10699)
Topic: 10684 - The jackpot
Replies: 34
Views: 18683

Re: 10684 - The Jackpot

I got TLE with this code but when I tried n=10000 it work faster than 3s. Please help me improve my code. #include<stdio.h> #include<algorithm> using namespace std; int main() { int sum,n[10005],tmp[10005],big; while(1) { scanf("%d",&sum); if(sum==0) break; for(int i=0;i<sum;i++) { scanf("%d",&n[i])...
by Scorvus
Wed Apr 24, 2013 3:36 pm
Forum: Volume 100 (10000-10099)
Topic: 10055 - Hashmat the Brave Warrior
Replies: 166
Views: 45507

Re: 10055 - Hashmat the Brave Warrior

It works! thanks a lot :D
btw if i want to read only 1 input until the end of input, does the code look like this?
while(scanf("%lld",&e) == 1) {
by Scorvus
Tue Apr 23, 2013 4:41 pm
Forum: Volume 100 (10000-10099)
Topic: 10055 - Hashmat the Brave Warrior
Replies: 166
Views: 45507

Re: 10055 - Hashmat the Brave Warrior

what this line do?

while(scanf("%lld %lld",&h,&e) == 2) {

i'm sorry, i'm new with this thing.
by Scorvus
Sun Apr 21, 2013 8:25 pm
Forum: Volume 100 (10000-10099)
Topic: 10055 - Hashmat the Brave Warrior
Replies: 166
Views: 45507

Re: 10055 - Hashmat the Brave Warrior

what's wrong with my code? i got WA with this

Code: Select all

#include<stdio.h>
int main()
{
	long long int h,e;
	while(!EOF)
	{
		scanf("%lld %lld",&h,&e);
		if(h<e)
			printf("%lld\n",e-h);
		else
			printf("%lld\n",h-e);
	}
	return 0;
}

Go to advanced search