|
|
back to boardWA in C++, why? Hello! Why I got WA? I can't understand :| IMO this must work... Tnx all. ---------------------------------------------------- dayTotal = (LastDay - FirstDay) + 1; for(counter = 1; counter <= dayTotal; counter++) { n = counter % 2; if(n != 0) fuse++; } ----------------------------------------------------- Re: WA in C++, why? Posted by JDBaha 3 Jul 2012 15:37 #include <iostream> int main() { int a,b; int answer=0; std::cin>>a>>b; if(a%2==0)a++; for(int i=a;i<=b;i+=2) answer++; std::cout<<answer; return 0; } Re: WA in C++, why? Posted by prime 15 Oct 2016 15:09 JDBaha your solution is wrong. for 2 4 it says 1. Edited by author 15.10.2016 15:10 Edited by author 15.10.2016 15:10 |
|
|