6 条题解
- 1
信息
- 编号
- 2328
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 3
- 标签
- 递交数
- 116
- 已通过
- 41
- 上传者
大风起兮云飞扬, 切个水题来暖场。 开头命令先判断, 是0输‘1’别入坑。
咳咳,(脑细胞大量死亡中)
直接上代码······
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,t=0;
cin>>n;
while(n)
{
n=n/10;
t++;
}
if(t>=1)
{
cout<<t;
}else{
cout<<1;
}
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,s=0;
cin>>a;
if(a==0)
{
cout<<"1";
return 0;
}
while(a!=0)
{
a/=10;
s++;
}
cout<<s;
return 0;
}