- 【例35.1】 分离整数的各个数位
第一次觉得自己写的弱智代码很帅
- 2024-8-18 16:53:09 @
#include<bits/stdc++.h>
using namespace std;
int i = 2;
int main()
{
int a;
cin >> a;
cout << a % 10 << " ";
while(a >= pow(10,i - 1)){
cout << (a % (int)pow(10,i) - a % (int)pow(10,i - 1)) / pow(10,i - 1) << " ";
i++;
}
return 0;
}
3 comments
-
Chaser Of Light LV 10 @ 2024-8-19 12:22:39
我觉得挺好
#include<iostream> #include<list> using namespace std; main(){ int n; cin>>n; list<int> a; list<int>::iterator it; while(n>0){ a.push_back(n%10); n/=10; } for(list<int>::iterator it=a.begin();it!=a.end();it++){ cout<<*it<<" "; } } ``` `
-
2024-8-18 18:15:19@
写的很好,初赛的题目还在远方等待着你,加油少年
👍 1 -
2024-8-18 16:53:33@
真的很弱智
- 1
Information
- ID
- 123
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 2
- Tags
- # Submissions
- 26
- Accepted
- 21
- Uploaded By