Codeforces Round #754 (Div. 2), problem: (A) A.M. Deviation泪目 万万没想到狂wa是因为这

Problem - A - Codeforces

题目

 

题意很简单每次操作可以使得a1 a2  a3任意两个数分别+1  -1

求最后使得a+c-2b绝对值的最小值

 

BUG就是最后忽略了-2和2这一点, 他们再进行一次操作就可以变成1和-1, 最后的绝对值也就是1, 所以最后的答案没有2  ! ! !

 

官方代码

#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    ios_base::sync_with_stdio(0); 
    cin.tie(0); cout.tie(0);
    int T; cin >> T;
    while(T--)
    {
        int a, b, c; cin >> a >> b >> c;
        cout << ((a + c - 2 * b) % 3 == 0 ? 0 : 1) << "\n"; 
    }        
    return 0;
}

 

posted @ 2021-11-13 09:57  la-la-wanf  阅读(36)  评论(0)    收藏  举报