Show all threads Hide all threads Show all messages Hide all messages |
WA 5 | Akashi | 1327. Fuses | 9 Jan 2024 18:04 | 2 |
WA 5 Akashi 13 Sep 2022 21:57 a = int(input()) b = int(input()) if a %2==1 and b%2==1: print(int((b-a)/2+1)) else: print((b-a)//2) Why WA?? What if a = 2 and b = 3? The answer will be 1 but your code will give 0. Now fix it. |
What's wrong? Guys, help!! | Sergey Volodin | 1327. Fuses | 16 Oct 2018 20:46 | 2 |
a=int(input()) b=int(input()) i=a w=0 while i<=b: w=w+1 i=i+2 if (a%10==0): w=w-1 print(w) first = int(input()) second = int(input()) count = 0 for i in range(first, second + (second % 2 != 0), 2): count += 1 print(count) |
No subject | Sergey Volodin | 1327. Fuses | 7 Jan 2018 14:21 | 1 |
Edited by author 07.01.2018 14:22 Edited by author 07.01.2018 14:23 |
Why is answer 1 for a=2 and b=4 correct??? and 50 for 100 200? | prime | 1327. Fuses | 16 Oct 2016 00:11 | 3 |
For 2 4 it should be days 2 and 4. For 100 200 it shoould be 100, 102...148(count must be 25 already)...200(count is 51). Janus brokes fuses every ODD day. There is 1 odd day in interval [2..4] Hmm... I see that I just did not understand the task clearly. For me it was like day 2 is the first day, but it is just the starting point of counting... Thanks. |
WA in C++, why? | Marten Gerr | 1327. Fuses | 15 Oct 2016 15:09 | 3 |
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++; } ----------------------------------------------------- #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; } 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 |
WA #7 Test | Konstantine Muradov | 1327. Fuses | 14 Aug 2015 03:08 | 1 |
Hello, here is my code using System; public class Program { public static void Main(String[] args) { var a = Convert.ToInt32(Console.ReadLine()); var b = Convert.ToInt32(Console.ReadLine()); var ans = (b-a + 1) / 2; if (b % 2 > 0) ans++; Console.WriteLine(ans); } } I can not find out the problem :( |
Please, help! | Shaft | 1327. Fuses | 15 Jul 2015 20:05 | 1 |
I can't understand what's wrong in my code, it write 51 instead of 50 #include <iostream> using namespace std; int main() { unsigned short a, b, c; cin >> a >> b; c = (b - a) + 1; if(c % 2 == 0) cout << c / 2; else cout << (c / 2) + 1; /// 1! 2 3! 4 5! 6 7! 8 9! 10 11! 12 13! 14 15! return 0; } |
WA TEST #4 c++ | jhujhu | 1327. Fuses | 2 Apr 2015 00:57 | 2 |
#include <iostream> using namespace std; int main() { int aNumber, bNumber; cin>>aNumber; cin>>bNumber; if(bNumber > aNumber) { cout<< ((bNumber-(aNumber + (aNumber%2? 0:1) ))/2) + 1; } else if(bNumber == aNumber) { cout<<"1"; } } what might be test case #4 ? Try this: 4 4 The answer should be 0. Edited by author 02.04.2015 00:59 |
c++ AC | amirshir | 1327. Fuses | 23 Dec 2014 12:11 | 1 |
c++ AC amirshir 23 Dec 2014 12:11 #include <iostream> using namespace std; int main() { int a,b ; cin>>a>>b ; int c=b-a+(a%2)+(b%2) ; cout<<c/2 ; } |
c# accepted | pav1uxa | 1327. Fuses | 21 Dec 2014 15:33 | 1 |
del Edited by author 06.01.2015 21:37 |
solution and explanation | Davit Safrastyan [RAU] | 1327. Fuses | 5 Oct 2014 22:48 | 1 |
Find the solution and explanation of this task in manyprogrammingtutorials.blogspot.com |
Here's my AC | HM2P33 | 1327. Fuses | 4 Feb 2013 22:20 | 1 |
#include <iostream> using namespace std; int main(void){ int a,b,res; cin>>a>>b; res = (b-a +1)/ 2; if((b-a +1)&1 and b&1) res++; cout<<res<<endl; return 0; } |
Could anybody show me the formula? | Endorphin | 1327. Fuses | 14 Oct 2012 16:22 | 5 |
I've got AC by stupid brute force, like if (i % 2) k++;. But i think that there is a easier way to solve this task. Topic. но это не тупой брутфорс, просто в четные дни он не ломает предохранители. 100-ый день четный, поэтому ответ 50, а не 51 Seriously, guys, put away correct formulas, please. If ((last day) mod 2 = 0) than formula = ((b - a)+1)/2 else formula = ((b - a) + 2) / 2 I got AC Because if we our seconf day mod = 0, it means, that we mustn't count last day, only add 1. If our second day mod 2 = 1, it means, that we must count second day, add 2. That's easy Edited by author 14.10.2012 16:23 Edited by author 14.10.2012 16:24 |
what's the meaning of the problem? | HybridTheory | 1327. Fuses | 8 Sep 2012 21:15 | 6 |
What it ask us to do? Who can explain me the work. Thanks. It isn`t anything complex . It gives u the beginning and ending of an interval : A and B and wants you to calculate how many digits in this interval ( including the numbers A and B ) are odd. So u see it is just as simple. Good luck. Edited by author 17.10.2004 21:12 What if a=1 and b=1? Should the answer be 1? |
acepted | kostan3 | 1327. Fuses | 7 Jun 2012 23:36 | 1 |
изменил в коде одну букву и он прошёл кому нужен код kostan3@spaces.ru |
why 50? | ASARI | 1327. Fuses | 19 Feb 2012 21:17 | 2 |
in second test true reult 51. The fusses blew up only in days where d%2==1 ( is something wrong with the problem description because it doesn't specify this ). |
Wrong answer Test 1 Pascal | XackerGT | 1327. Fuses | 18 Nov 2011 18:56 | 1 |
program bif; var a,b,c,d:integer; i:real; begin readln (a,b); c:=((b-a)+1) mod 2; if c=0 then i:=((b-a+1)/2) else begin i:=((b-a) div 2)+1; d:=b mod 2; if d=0 then i:=i-1; end; if a=b then i:=1; writeln (i); readln; end. |
I can't understand the problem | Darth Niculus(Ivan Nicolae) | 1327. Fuses | 21 Aug 2011 16:45 | 2 |
What does this problem mean? it's very easy to write after understand the problem. The problem is that one man is making something in every day after day.for example he will make something in first day then in third day then in 5th day an so on.you should calculate how many things he will do from A to B. A and B are integers to understand you can think that they are numbers of the day in year. sorry for mu English. Regards |
Осторожно! | OZone3 | 1327. Fuses | 1 May 2011 14:29 | 4 |
Похоже, что во входных строчках помимо чисел A и B присутствуют ещё и пробелы. Или другие пустые символы... You are wrong. Tests contain only two integers with exactly one end of line after each of them (no other characters). I've got AC after I added .Trim(). But there could also be another unnoticed change in my code which actually fixed it. So anyway, extra precautions would never do the harm. :) Thanks for your time examining input validity, Sandro! speak English, respect other |
Here is my AC program | Pimp | 1327. Fuses | 7 Dec 2010 15:44 | 6 |
var m,n,i,k:integer; begin readln(n,m);k:=0; for i:=n to m do if odd(i) then inc(k); writeln(k);readln; end. I'd say this is a brute force. Here is mine AC: var a,b,c:integer; begin readln(a,b); c:=(b-a+1) div 2; if (odd(b)) and (odd(a)) then inc(c); writeln(c); end. Why do you post your ACC programs here ? This is a bad practice. Edited by author 19.07.2006 16:22 This is shorter b shr 1 - a shr 1 + b and 1 (b - a) / 2 + (a % 2 | b % 2) |