Search found 28 matches

by scott1991
Mon Mar 10, 2008 10:19 pm
Forum: Volume 100 (10000-10099)
Topic: 10035 - Primary Arithmetic
Replies: 328
Views: 57699

why does my code output the first answer wrongly and then the rest correct as far as i can see. Cheers for any help. #include <stdio.h> #include <math.h> int main() { long long int a, b, carry=0,temp; int length; while(scanf("%lld%lld",&a,&b)==2) { if(a==0&&b==0) { return 0; } if(a<b) { temp=a;a=b;b...
by scott1991
Mon Mar 10, 2008 8:35 pm
Forum: Volume 5 (500-599)
Topic: 591 - Box of Bricks
Replies: 80
Views: 11265

i thought i did with

Code: Select all

int n,h=0,average=0,moves=0,set=1;
if this wasn't initializing 'average', what is please? cheers.
by scott1991
Sun Mar 09, 2008 10:01 pm
Forum: Volume 5 (500-599)
Topic: 591 - Box of Bricks
Replies: 80
Views: 11265

can someone please give me some help in speeding up my program as i'm getting tle... #include <iostream> int main() { int n,h=0,average=0,moves=0,set=1; int* heights = new int [60]; a: scanf("%d",&n); if(n<1) { return 0; } else { while(h<n) { scanf("%d",&heights[h]); average+=heights[h]; h++; } h=0;...
by scott1991
Sun Mar 09, 2008 8:23 pm
Forum: Volume 100 (10000-10099)
Topic: 10071 - Back to High School Physics
Replies: 49
Views: 7610

why am i getting re?

Code: Select all

#include <stdio.h>

int main()
{
long int v, t; 

while(scanf("%lld %lld", &v, &t)==2) 
{ 
printf("%lld\n", (2*t*v)); 
}
return 0;
} 
by scott1991
Sun Mar 09, 2008 7:59 pm
Forum: Volume 100 (10000-10099)
Topic: 10055 - Hashmat the Brave Warrior
Replies: 166
Views: 46417

WHAT AM I DOING WRONG?????

Code: Select all

#include <iostream>

int main()
{
	unsigned int a, s,temp;
	while(scanf("%u%u",&a,&s)==2)
	{
		if(s<a)
		{
		temp=s;
		s=a;
		a=temp;
		}
		printf("%u\n",s-a);
	}
	return 0;
}
by scott1991
Sat Mar 08, 2008 5:46 pm
Forum: Bugs and suggestions
Topic: Spam when looking for unanswered posts.
Replies: 2
Views: 1618

Spam when looking for unanswered posts.

Obviously people have noticed all the spam posts, porn and the likes, which i feel is not good for the site as there are the odd young user and it also effect users trying to help others. there have been times when i have been looking to see if i can help people and i have given up as i just have ha...
by scott1991
Sat Mar 08, 2008 5:35 pm
Forum: Volume 6 (600-699)
Topic: 694 - The Collatz Sequence
Replies: 46
Views: 15963

I'm getting tle and have no idea on making it faster...can someone help please? #include<iostream> int main() { unsigned int start, max, terms=1,test=1,A; a: scanf("%u %u",&start,&max); if(start<0&&max<0) {return 0;} else { A=start; while(start<=max&&start!=1) { start = (start&1)==0?(start>>1):(star...
by scott1991
Sat Mar 08, 2008 2:08 pm
Forum: Volume 108 (10800-10899)
Topic: 10880 - Colin and Ryan
Replies: 45
Views: 28084

thanks jan.. AC now
by scott1991
Sat Mar 08, 2008 12:55 pm
Forum: Volume 108 (10800-10899)
Topic: 10880 - Colin and Ryan
Replies: 45
Views: 28084

this is my new code but i'm getting wa...anyone know why? cheers.

Code: Select all

AC now!!
by scott1991
Fri Mar 07, 2008 11:19 pm
Forum: Volume 108 (10800-10899)
Topic: 10880 - Colin and Ryan
Replies: 45
Views: 28084

Hi. I have TLE too...this is my code:

Code: Select all

Ac now!!
i get all the test cases right along with all those i have tested from these pages...can anyone help me speed my program up? thanks.
by scott1991
Sat Dec 15, 2007 5:22 pm
Forum: Volume 110 (11000-11099)
Topic: 11038 - How Many O's?
Replies: 24
Views: 10422

what does k equal? what does it stand for?
by scott1991
Sat Dec 15, 2007 4:04 pm
Forum: Volume 110 (11000-11099)
Topic: 11038 - How Many O's?
Replies: 24
Views: 10422

lol...well i didn't understand a word of that(i'm only 16), could you please explane it more simply please? cheers. Scott
by scott1991
Sat Dec 15, 2007 3:46 pm
Forum: Volume 110 (11000-11099)
Topic: 11038 - How Many O's?
Replies: 24
Views: 10422

how would i do that? any tips? cheers
by scott1991
Sat Dec 15, 2007 2:58 pm
Forum: Volume 110 (11000-11099)
Topic: 11038 - How Many O's?
Replies: 24
Views: 10422

HI. I've written the following code for this problem but havn't submitted it yet as it doesn't work even on my machine. I was wondering why it won't work for the large sample inputs and would apreciate any help. Cheers. Scott #include <iostream> #include <math.h> int main(int argc, char* argv[]) { u...
by scott1991
Sat Dec 15, 2007 2:18 pm
Forum: Volume 110 (11000-11099)
Topic: 11000 - Bee
Replies: 25
Views: 12223

cheers again. Ac now :D

Go to advanced search