10 条题解
-
1
#include <queue> #include <math.h> #include <stack> #include <stdio.h> #include <iostream> #include <vector> #include <iomanip> #include <string.h> #include <algorithm> using namespace std; #define int long long const int N = 1e5 + 10; const int INF = 0x3f3f3f3f; int a, ans; char c; signed main() { scanf("%lld ", &a); c = getchar();//字符专用输入方式 if(a < 1001)//判断重量是否在1000以内 ans = 8; else ans = 8 + ((a - 1000) / 500 + 1) * 4; if(c == 'y')//判断是否加急 ans += 5; printf("%lld\n", ans); return 0; }纯享版:
#include <stdio.h> int a, ans; char c; signed main() { scanf("%lld ", &a); c = getchar(); if(a < 1001) ans = 8; else ans = 8 + ((a - 1000) / 500 + 1) * 4; if(c == 'y') ans += 5; printf("%lld\n", ans); return 0; } -
0
史上最简AC代码:
#include<bits/stdc++.h> using namespace std; int main(){ int g,yuan=8; char fu; cin>>g>>fu; if(g<=1000&&fu=='y'){cout<<13; return 0;} if(g<=1000&&fu=='n'){cout<<8; return 0;} g-=1000; while(g>0){yuan+=4; g-=500;} if(fu=='y') cout<<yuan+5; else cout<<yuan; return 0;}看不懂的话看下面:
#include<bits/stdc++.h> using namespace std; int main(){ int g,yuan=8; char fu; cin>>g>>fu; if(g<=1000&&fu=='y'){cout<<13; return 0;} if(g<=1000&&fu=='n'){cout<<8; return 0;} g-=1000; while(g>0){yuan+=4; g-=500;} if(fu=='y') cout<<yuan+5; else cout<<yuan; return 0; }
- 1
信息
- ID
- 2910
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 5
- 标签
- 递交数
- 606
- 已通过
- 189
- 上传者