- Factorial
【基础】小X转进制
- 2025-1-12 11:11:58 @
韦老师班专用!
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,m,cnt=0;
cin>>n>>m;
for(int i=1;i<=n;i++){
string s1,s2;
int x=i*i;
while(x){
if(x%m>=10) s1.push_back(x%m+55);
else s1.push_back(x%m+'0');
x=x/m;
}
s2=s1;
reverse(s2.begin(),s2.end());
if(s1==s2) cnt++;
}
cout<<cnt;
return 0;
}
2 条评论
-
wangxiaoyu @ 2025-1-20 10:14:29
- #include<bits/stdc++.h>
- using namespace std;
- int main(){
-
string s;
-
int flag =1;
-
while(cin>>s){
-
if(flag==1)
-
cout<<s.size();
-
else
-
cout<<','<<s.size();
-
flag++;
- }
-
return 0;
- }
-
2025-1-20 10:13:26@
- #include<bits/stdc++.h> using namespace std; int main(){ string s; int flag =1; while(cin>>s){ if(flag==1) cout<<s.size(); else cout<<','<<s.size(); flag++; } return 0; }
- 1
信息
- ID
- 21
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 1
- 标签
- 递交数
- 170
- 已通过
- 43
- 上传者