ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1327. Fuses

Marten Gerr WA in C++, why? [2] // Problem 1327. Fuses 28 Apr 2012 04:57
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++;
    }
-----------------------------------------------------
JDBaha Re: WA in C++, why? [1] // Problem 1327. Fuses 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;
}
prime Re: WA in C++, why? // Problem 1327. Fuses 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