4 条题解
-
1
题目直接把我整蒙了。
#include<bits/stdc++.h> #define int long long #define INF 0x3f3f3f using namespace std; int x,zero; char c; signed main(){ cin>>x>>c; int ans; if(x<=1000){ if(c=='n')cout<<"8"; else cout<<"13"; return 0; } if(x%500)ans=((x-1000)/500+1)*4+8; else ans=((x-1000)/500)*4+8; if(c=='y')ans+=5; cout<<ans; return 0; }
-
0
C++ :
#include<bits/stdc++.h> using namespace std; int main(){ int a,c,d,e; char b; cin>>a>>b; if(a<=1000&&b=='y'){ c=8+5; cout<<c; } else if(a<=1000&&b=='n'){ c=8; cout<<c; } else if(a>1000&&b=='n'){ d=(a-1000)/500; e=(a-1000)%500; if(e!=0){ d+=1; } c=d*4+8; cout<<c; } else{ d=(a-1000)/500; e=(a-1000)%500; if(e!=0){ d+=1; } c=d*4+8+5; cout<<c; } }
Python :
# coding=utf-8 x,y=input().split() x=int(x) s=0 if x<=1000: s=8 else: if (x-1000)%500==0: s=8+(x-1000)//500*4 else: s=8+(x-1000)//500*4+4 if y=='y': s=s+5 print(s)
- 1
信息
- ID
- 20
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 3
- 标签
- (无)
- 递交数
- 43
- 已通过
- 25
- 上传者