Search found 15 matches

by apcastelein
Wed Jul 01, 2015 4:00 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 181781

Re: 100 - The 3n + 1 problem

Your f function isn't working properly. If 1 is inputted the output should be 1 however in your case the output is 0.
by apcastelein
Tue Sep 09, 2014 7:07 pm
Forum: Volume 7 (700-799)
Topic: 793 - Network Connections
Replies: 102
Views: 30866

Re: 793 - Network Connections

Sorry my bad

Old Code:

Code: Select all

Thank you
by apcastelein
Mon Sep 08, 2014 11:04 pm
Forum: Volume 7 (700-799)
Topic: 793 - Network Connections
Replies: 102
Views: 30866

Re: 793 - Network Connections

I printed a blank line between test cases as brianfry713 said but that wasn't enough to get AC. After implenting lighted's modification it worked but I don't understand how that change works since I seem to be getting the same output for all of my test cases.
by apcastelein
Mon Sep 01, 2014 7:53 pm
Forum: Volume 7 (700-799)
Topic: 793 - Network Connections
Replies: 102
Views: 30866

Re: 793 - Network Connections

Ok thanks. I've adjusted my code. Now I get runtime error

Code: Select all

I got AC Thanks :)
by apcastelein
Thu Aug 28, 2014 5:14 am
Forum: Volume 7 (700-799)
Topic: 793 - Network Connections
Replies: 102
Views: 30866

Re: 793 - Network Connections

Hello I've tried several test cases on mine. I'm not sure why I'm getting WA I got AC Thanks :) I've noticed reading through this thread that the input output is of the format #testcases #computers cmd1 cmd2 cmd3 ... #computers cmd1 cmd2 ... My code isn't made to handle this but I read through the p...
by apcastelein
Sun Aug 17, 2014 10:43 pm
Forum: Volume 100 (10000-10099)
Topic: 10038 - Jolly Jumpers
Replies: 445
Views: 78648

Re: 10038 - Jolly Jumpers

You're code checks if the differences sum to what they would sum to if each difference in the sequence was accounted for. However there are cases when the differences sum correctly but not all differences are accounted for. Try this 1 1 4 7 This sequence isn't jolly but I believe your code will retu...
by apcastelein
Fri Aug 01, 2014 12:46 am
Forum: Volume 101 (10100-10199)
Topic: 10114 - Loansome Car Buyer
Replies: 38
Views: 13410

Re: 10114 - Loansome Car Buyer

Correct.

When I was trying to figure out the problem I came across this article, and that is one of the things which messed up his algorithm

http://denny518.blogspot.com/2013/12/ac ... e-car.html
by apcastelein
Tue Jul 29, 2014 7:03 pm
Forum: Volume 5 (500-599)
Topic: 599 - The Forrest for the Trees
Replies: 18
Views: 7730

Re: 599-The forest for the trees

Thank you very much. I got it accepted now.
by apcastelein
Mon Jul 28, 2014 3:59 pm
Forum: Volume 5 (500-599)
Topic: 599 - The Forrest for the Trees
Replies: 18
Views: 7730

Re: 599-The forest for the trees

I'm having an issue with my code. It works for the sample input but I get RE when submitting #include <stdio.h> #include <map> #include <vector> using namespace std; typedef vector<int> vi; class UnionFind{ private: vi p,rank; int singles, sets; public: UnionFind(int N){ singles=sets=N; rank.assign(...
by apcastelein
Sun Jul 27, 2014 5:31 am
Forum: Volume 102 (10200-10299)
Topic: 10226 - Hardwood Species
Replies: 121
Views: 37952

Re: 10226 - Hardwood Species

I adapted it to use gets(), I've got Accepted now. Thank you very much for the help
by apcastelein
Fri Jul 25, 2014 5:31 pm
Forum: Volume 102 (10200-10299)
Topic: 10226 - Hardwood Species
Replies: 121
Views: 37952

Re: 10226 - Hardwood Species

I've modified my code. I haven't figured out how to address all the issues you mentioned but here it is #include <stdio.h> #include <map> #include <string> using namespace std; int main(){ int TC,tot; double p; string name; char* str; map<string,int> m; scanf("%d",&TC); while(TC--){ tot=0; while(sca...
by apcastelein
Fri Jul 25, 2014 5:40 am
Forum: Volume 102 (10200-10299)
Topic: 10226 - Hardwood Species
Replies: 121
Views: 37952

Re: 10226 - Hardwood Species

I'd like to solve it using STL map but I'm having some issues. #include <stdio.h> #include <map> #include <string> using namespace std; int main(){ int TC,tot; double p; string name; map<string,int> m; scanf("%d\n\n",&TC); while(TC--){ tot=0; while(scanf("%30s",name.c_str())==1){ m[name]++; tot++; }...
by apcastelein
Thu Jul 24, 2014 3:28 pm
Forum: Volume 100 (10000-10099)
Topic: 10038 - Jolly Jumpers
Replies: 445
Views: 78648

Re: 10038 - Jolly Jumpers

I'm having trouble with the IO in this problem. I enter the first line of numbers then I go to the next line and the program ends. It might be because I'm doing it in cmd. I've tried using "type UVa10038.in | UVa10038.exe" to input all data but I get similar results. My program doesn't print anythin...
by apcastelein
Wed Jul 23, 2014 3:25 am
Forum: Volume 101 (10100-10199)
Topic: 10114 - Loansome Car Buyer
Replies: 38
Views: 13410

Re: 10114 - Loansome Car Buyer

Ahh I see. I did learn to return 0, but I'm still new to C++ so I guess it hasn't completely sunk in yet. Thanks for the help, I really appreciate it.
by apcastelein
Wed Jul 23, 2014 1:01 am
Forum: Volume 101 (10100-10199)
Topic: 10114 - Loansome Car Buyer
Replies: 38
Views: 13410

Re: 10114 - Loansome Car Buyer

I've tried all the test cases given in this thread and I get the right answer for all of them. When I submit my code I get a runtime erorr. I've checked it for array index out of bounds and division by zero and I'm pretty sure those errors can't happen. #include <stdio.h> int main(){ int borMonths; ...

Go to advanced search