Search found 4 matches

by Shadow_Coder
Fri Jun 20, 2014 3:51 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 319809

Re: If you get WA in problem 100, read me before post!

I got AC, but tell me, why do we need a newline character at the end of the last line, when it is not so in the sample output?
by Shadow_Coder
Thu Jun 19, 2014 10:45 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 319809

Re: If you get WA in problem 100, read me before post!

Given below is my code. It works for all the test cases which I've tried, it swaps i and j, if i>j as well. Yet, it's still getting WA. Any suggestions?

#include <iostream>
#include <algorithm>
using namespace std;

int cycleLength(int k){
int count=1;
while(k!=1){
if(k%2==0) { k = k/2; }
else ...
by Shadow_Coder
Tue Jun 17, 2014 9:33 am
Forum: Volume 4 (400-499)
Topic: 483 - Word Scramble
Replies: 122
Views: 39180

Re: Getting WA with 483 Word Scramble

Thanks, got AC! I had to prevent the newline and the space at the end of the last line. Below is the code.

#include <sstream>
#include <string>
#include <iostream>
using namespace std;

string strrev(string s){
string t(s.rbegin(), s.rend());
return t;
}

int main() {
string s, t;
while(!cin ...
by Shadow_Coder
Mon Jun 16, 2014 2:31 pm
Forum: Volume 4 (400-499)
Topic: 483 - Word Scramble
Replies: 122
Views: 39180

Getting WA with 483 Word Scramble

Hello. I'm trying to solve the 483 Word Scramble problem, but I'm getting WA. When I run the code on my computer with the given test data, the result comes alright. But, it still gets a WA. Below given is my code. Can anybody help me?

#include <sstream>
#include <string>
#include <iostream>
using ...

Go to advanced search