先这样再那样即可
#include<bits/stdc++.h> using namespace std; signed main(){ int n; cin>>n; cout<<n/5+n/30; }
#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; cout<<n/5+(n/5)/6; }
又是一道水题
直接输出好吧:
#include<iostream> #define QwQ return 0; using namespace std; int n; int main(){ cin>>n; n/=5; n+=n/6; cout<<n; QwQ }
分段。分成优惠和不优惠两段,其中优惠是 ⌊n30⌋\lfloor \frac{n}{30}\rfloor⌊30n⌋ 元,而不优惠是 nnn mod \bmodmod 303030 元。
#include<bits/stdc++.h> #define int long long #define INF 0x3f3f3f using namespace std; int n; signed main(){ cin>>n; cout<<n/30*7+n%30/5;//地板除 return 0; }
注意审题。。。
#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; cout<<n/5+n/5/6; return 0; }
C++ :
#include<iostream> using namespace std; int main(){ int q; cin>>q; q/=5; if(q>=6){ cout<<q+q/6<<endl; } else{ cout<<q<<endl; } return 0; }
Python :
# coding=utf-8 s=int(input()) a=int(s//5+s//30) print(a)
注册一个 QZ 通用账户,您就可以在我们提供的所有在线评测服务上提交代码、参与讨论。
使用您的 QZ 通用账户