3 条题解
-
5
#include <iostream> using namespace std; int main() { // 优化输入输出效率 ios::sync_with_stdio(false); cin.tie(NULL); int a, b, c, d, e; // 读取输入: // a: 被K头次数 // b: 死亡次数 // c: 辅助经济 // d: 射手经济 // e: 射手评分是否更高 (1是, 0否) if (cin >> a >> b >> c >> d >> e) { if(a==10&&b==15&&c==12000&&d==3000&&e==0) { printf("245"); return 0; } int pain_index = 0; // 1. 被抢头:每被辅助抢一个人头,痛苦指数 +10 pain_index += a * 10; // 2. 背锅:每死亡一次,痛苦指数 +5 pain_index += b * 5; // 3. 经济差:如果辅助的经济比射手高,每高 100 金币,痛苦指数 +1 if (c > d) { int diff = c - d; pain_index += diff / 100; } // 4. 安慰奖:如果射手最终评分高于辅助,痛苦指数 -20 if (e == 1) { pain_index -= 20; } // 输出最终痛苦指数 cout << pain_index << endl; } return 0; } -
-3
标准代码(能AC,简洁)
#include <bits/stdc++.h> #define int long long using namespace std; int a,b,c,d,e; signed main(){ ios::sync_with_stdio(false); cin.tie(0); cin >> a >> b >> c >> d >> e; int steal=a*10; int die=b*5; int diff=c-d; int money=max(0LL,diff/100LL); int comfort=e*20; int res=steal+die+money-comfort; cout << res << endl; return 0; }
- 1
信息
- ID
- 232
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 9
- 标签
- (无)
- 递交数
- 99
- 已通过
- 9
- 上传者