AC:
#include<iostream> using namespace std; int main() { int N; while(cin>>N) { int a[50],i=0; do{ a[i++]=N%8; N/=8; }while(N!=0); for(int j=i-1;j>=0;j--) cout<<a[j]; cout<<endl; } return 0; }
时间: 2024-11-07 18:42:34
AC:
#include<iostream> using namespace std; int main() { int N; while(cin>>N) { int a[50],i=0; do{ a[i++]=N%8; N/=8; }while(N!=0); for(int j=i-1;j>=0;j--) cout<<a[j]; cout<<endl; } return 0; }