Harbour.Space Scholarship Contest 2021-2022 (open for everyone, rated, Div. 1 + Div. 2)

Posted Jozky86

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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)

题号题目知识点
ADigits Sum签到
BReverse String
CPenalty
DBackspace
EPermutation Shift
FPairwise Modulo
GCommon Divisor Graph
HXOR and Distance
IStairs

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)的主要内容,如果未能解决你的问题,请参考以下文章

Harbour.Space Scholarship Contest 2021-2022 (open for everyone, rated, Div. 1 + Div. 2) D题解

Harbour.Space Scholarship Contest 2021-2022 (open for everyone, rated, Div. 1 + Div. 2)(补题)

http://harbour.space/ - 这是啥 jQuery 效果?当我缩小圆圈消失[关闭]

2267: Scholarship(规律题)

在 .CSV 文件中为 XML 解析创建 XSL