4 条题解
-
-1
辛雨的题解来了! 屎山迷宫YYDS
#include<bits/stdc++.h> using namespace std; typedef long long ll; ll cmp[100001]; int main(){ int t; cin >>t; int tmp = 0; for(int i = 0;i<t;i++){ ll a,b,c; cin >>a>>b>>c; cmp[i] = a; if(b % 3 >= c&&b != 0&&c != 0){ cmp[i] = -1; } else if(b % 3 == 0){ cmp[i] += b / 3; if (c % 3 == 0){ cmp[i] += c / 3; } else{ cmp[i] += c / 3 + 1; } } else if(b % 3 == 1){ if(c - 2 >= 0){ cmp[i] += b / 3 + 1; c-=2; if (c % 3 == 0){ cmp[i] += c / 3; } else{ cmp[i] += c / 3 + 1; } } else{ cmp[i] = -1; tmp++; break; } } else if(b % 3 == 2){ if(c - 1 >= 0){ cmp[i] += b / 3 + 1; c--; if (c % 3 == 0){ cmp[i] += c / 3; } else{ cmp[i] += c / 3 + 1; } } else{ cmp[i] = -1; tmp++; break; } } tmp++; } for (int i = 0;i<tmp;i++){ cout <<cmp[i]<<endl; } }
信息
- ID
- 726
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 8
- 标签
- (无)
- 递交数
- 319
- 已通过
- 50
- 上传者