Harbour.Space Scholarship Contest 2021-2022 (open for everyone, rated, Div. 1 + Div. 2)
生活随笔
收集整理的這篇文章主要介紹了
Harbour.Space Scholarship Contest 2021-2022 (open for everyone, rated, Div. 1 + Div. 2)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Harbour.Space Scholarship Contest 2021-2022 (open for everyone, rated, Div. 1 + Div. 2)
| A | Digits Sum | 簽到 |
| B | Reverse String | 思維 |
| C | Penalty | 思維 |
| D | Backspace | 逆向思維 |
| E | Permutation Shift | 置換群 |
| F | Pairwise Modulo | |
| G | Common Divisor Graph | |
| H | XOR and Distance | |
| I | Stairs |
cf1553 A. Digits Sum
題意:
定義S(x):為x的各位之和
問1<=x<=n,存在多少S(x+1)<S(x)?
題解:
不難看出滿足這個情況的x末尾肯定是9,而且仔細觀察輸出,貌似答案就是把最后一位抹去,但也不完全是,因為如果最后一位是9,它本身也是,所以答案是(x+1)/10
代碼:
#include<bits/stdc++.h> #define debug(a,b) printf("%s = %d\n",a,b); typedef long long ll; using namespace std; //qdu打鐵匠 inline int read(){int s=0,w=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();//s=(s<<3)+(s<<1)+(ch^48);return s*w; } int main() {int t;cin>>t;while(t--){int n;cin>>n;n++;cout<<n/10<<endl;} }總結
以上是生活随笔為你收集整理的Harbour.Space Scholarship Contest 2021-2022 (open for everyone, rated, Div. 1 + Div. 2)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 2.8K 120Hz 屏幕:小米 Red
- 下一篇: 吉利两款混动新车星瑞 L / 星越 L