这题挺有意思的
// 1065. A+B and C (64bit).cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
long long a, b, c;
int n;
cin >> n;
for(int i = 1; i <= n; i++){
cin >> a >> b >> c;
long long a1 = a / 3, b1 = b / 3, c1 = c / 3;
long long a2 = a % 3, b2 = b % 3, c2 = c % 3;
long long sum1 = a1 + b1 + (a2 + b2) / 3, sum2 = (a2 + b2) % 3;
if(sum1 > c1 || (sum1 == c1 && sum2 > c2))
cout << "Case #" << i << ": true" << endl;
else
cout << "Case #" << i << ": false" << endl;
}
return 0;
}

被折叠的 条评论
为什么被折叠?



