- 历届试题 核桃的数量
ee
- 2024-3-16 19:37:05 @
#include<bits/stdc++.h>
using namespace std;
char aa(int n,int k)
{
int a[101]={0},i=0;
for(i=1;n>0;i++)
{
a[i]=n%k;
n/=k;
}
i--;
for(;i>=1;i--)
{
if(a[i]>=10)
{
char l='A'+a[i]-10;
cout<<l;
}
else
{
cout<<a[i];
}
}
cout<<endl;
return 0;
}
int main()
{
int n;
cin>>n;
aa(n,2);
aa(n,8);
aa(n,16);
return 0;
}
0 comments
No comments so far...
Information
- ID
- 640
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 7
- Tags
- # Submissions
- 33
- Accepted
- 10
- Uploaded By