Search found 43 matches

by mgavin2
Fri Sep 23, 2016 9:05 pm
Forum: Volume 2 (200-299)
Topic: 227 - Puzzle
Replies: 56
Views: 16612

Re: 227 - Puzzle

Code: Select all

I won.
The ending condition is for sure:
fgets(line, some number, stdin);
if (line[0] == 'Z' && strlen(line) == 2) stop processing
make sure to read input line by line. it's imperative.
by mgavin2
Thu Sep 22, 2016 6:51 pm
Forum: Volume 109 (10900-10999)
Topic: 10905 - Children's Game
Replies: 66
Views: 32522

Re: 10905 - Children's Game

This problem is horribly written and doesn't include bounds on the input. Read and process everything as strings. The problem might talk about everything being integers, such as In next lines there are N positive integers. So you read and process items as int32s, then int64s... But the problem never...
by mgavin2
Thu May 05, 2016 11:05 pm
Forum: Other words
Topic: New language: Python ?
Replies: 10
Views: 10557

Re: New language: Python ?

hopefully anyone that searches the forums for python code submission format can find this:

I've submitted an AC solution with this format

Code: Select all

#!/usr/bin/python3

def main():
	*code*
	
if __name__ == "__main__":
	main()

by mgavin2
Sun Feb 14, 2016 1:51 am
Forum: Other words
Topic: New language: Python ?
Replies: 10
Views: 10557

Re: New language: Python ?

What's the format for submitting python source?

def main():
#entry point ?

or some kind of class Main?
by mgavin2
Thu Feb 26, 2015 4:48 am
Forum: Volume 4 (400-499)
Topic: 424 - Integer Inquiry
Replies: 96
Views: 35532

Re: 424 - Integer Inquiry

input: 1a 0 output 29 The java solution would throw a runtime error.. also: input -2 -1 0 gives *3 when the java solution should give -3 input: 000 0 gives nothing, when the java AC solution would report 0. I know the problem statement says: The input will consist of at most 100 lines of text, each ...
by mgavin2
Wed Feb 25, 2015 7:57 am
Forum: Volume 4 (400-499)
Topic: 424 - Integer Inquiry
Replies: 96
Views: 35532

Re: 424 - Integer Inquiry

The udebug code for this problem has to be wrong.
The java AC solution reads big integers until the number equals 0 and keeps the running sum.
by mgavin2
Sun Nov 02, 2014 8:09 pm
Forum: Volume 101 (10100-10199)
Topic: 10131 - Is Bigger Smarter?
Replies: 93
Views: 85178

Re: 10131 - Is Bigger Smarter?

Try input: 1000 4000 1100 3000 2000 1900 2002 1900 2001 1899 You code is correct if you remove the debug info it prints: 4 1 2 3 5 However if you change to left.weight < right.weight it incorrectly prints: 4 1 2 4 5 shouldn't 4 1 2 3 4 be an acceptable answer too? I've been getting WA from the judg...
by mgavin2
Thu Oct 09, 2014 6:17 am
Forum: Volume 4 (400-499)
Topic: 459 - Graph Connectivity
Replies: 133
Views: 44534

Re: 459 - Graph Connectivity - WA

Yeah... I was trying that... it's commented out in the main function because I was still getting WA Then I saw: shariftech, The outputs of two consecutive cases will be separated by a blank line. Always print a newline char at the end of the last line. and changed it and got WA *edit* actually, mayb...
by mgavin2
Wed Oct 08, 2014 6:30 pm
Forum: Volume 4 (400-499)
Topic: 459 - Graph Connectivity
Replies: 133
Views: 44534

Re: 459 - Graph Connectivity

I'm gonna throw my code up here because I'm not exactly sure what I'm doing wrong for this problem. I'm new to trying to solve graph problems (that weren't implicit graphs modeled as ascii maps for like floodfill problems), so I'm trying to model this problem input as an adjacency matrix... and I th...
by mgavin2
Tue Oct 07, 2014 11:19 pm
Forum: Volume 118 (11800-11899)
Topic: 11821 - High-Precision Number
Replies: 8
Views: 6381

Re: 11821 - High-Precision Number

omfg. Java BigDecimal method stripTrailingZeros only works some of the time (actually it seems to only work for zeros after the decimal point). Hence the stupidly looking use of compareTo.

Thank you brianfry
by mgavin2
Tue Oct 07, 2014 4:28 pm
Forum: Volume 118 (11800-11899)
Topic: 11821 - High-Precision Number
Replies: 8
Views: 6381

Re: 11821 - High-Precision Number

idk what could be wrong with this supposedly easy problem.... something really stupid is catching me.

Code: Select all

thanks brianfry
So here's my code while I go do something else. Thank you :)
by mgavin2
Sat Sep 13, 2014 9:36 pm
Forum: Volume 100 (10000-10099)
Topic: 10013 - Super long sums
Replies: 212
Views: 62652

Re: 10013 - Super long sums

is using java BigInteger TLE? I can't seem to optimize a java solution enough to pass the time limit.
by mgavin2
Sat Sep 13, 2014 9:30 pm
Forum: Off topic (General chit-chat)
Topic: brianfry713 -> how are you so good at test cases?
Replies: 3
Views: 16854

Re: brianfry713 -> how are you so good at test cases?

that's so smart... why was I trying to rely on human ingenuity :(

would you do this during an actual contest? to make it feasible for that enviroment
by mgavin2
Fri Sep 12, 2014 10:15 pm
Forum: Off topic (General chit-chat)
Topic: brianfry713 -> how are you so good at test cases?
Replies: 3
Views: 16854

brianfry713 -> how are you so good at test cases?

I'm wondering how you've developed the strategy to determine critical test cases so that I may share the knowledge with others.

Thanks in advance!
by mgavin2
Fri Aug 01, 2014 12:15 am
Forum: Volume 4 (400-499)
Topic: 444 - Encoder and Decoder
Replies: 155
Views: 40050

Re: 444 - Encoder and Decoder (runtime Error!)

Thank you. someone posting : 701997118012300111111117 3333332351100101110150141120123101411792310178 helped me change if (i+2 <= line.length()) to if (i+2 < line.length()) but it wasnt until I added if (cin.peek() == cin.eof()) return false; in my getInput() function that I finally got AC

Go to advanced search