mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
Create 1881.cpp
This commit is contained in:
parent
24296354e8
commit
b8d8bff064
32
QUSTOJ/1881.cpp
Normal file
32
QUSTOJ/1881.cpp
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
char ss[1024];
|
||||||
|
int css;
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int n,B;
|
||||||
|
cin>>n>>B;
|
||||||
|
css=0;
|
||||||
|
while(n>0)
|
||||||
|
{
|
||||||
|
int ndiv=n/B;
|
||||||
|
int nlef=n%B;
|
||||||
|
if(nlef<10)
|
||||||
|
{
|
||||||
|
ss[css]=nlef+'0';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ss[css]=nlef-10+'A';
|
||||||
|
}
|
||||||
|
css++;
|
||||||
|
n=ndiv;
|
||||||
|
}
|
||||||
|
for(int i=css-1;i>-1;--i)
|
||||||
|
{
|
||||||
|
cout<<ss[i];
|
||||||
|
}
|
||||||
|
cout<<"("<<B<<")"<<endl;
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user