Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
75420 张誉腾 十进制转R进制 C++ Compile Error 0 MS 0 KB 1779 2024-05-26 17:37:39

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main() { double n; cin>>n; int r; cin>>r; int z=n; double x=n-z; int b[32],cnt=0; while(z!=0) { int yu=z%r; b[cnt]=yu; cnt++; z/=r; } if(cnt==0) { cout<<0; } else { for(int i=cnt-1; i>=0; i--) { if(b[i]<10) { cout<<b[i]; } else { if(b[i]=10) { cout<<"A"; }else{ if(b[i]=11) { cout<<"B"; }else{ if(b[i]=12) { cout<<"C"; }else{ if(b[i]=13) { cout<<"D"; }else{ if(b[i]=14) { cout<<"E"; }else{ if(b[i]=15) { cout<<"F"; }else{ if(b[i]=16) { cout<<"G"; }else{ if(b[i]=17) { cout<<"H"; }else{ if(b[i]=18) { cout<<"I"; }else{ if(b[i]=19) { cout<<"J"; }else{ if(b[i]=20) { cout<<"K"; }else{ if(b[i]=21) { cout<<"L"; }else{ if(b[i]=22) { cout<<"M"; }else{ if(b[i]=23) { cout<<"N"; }else{ if(b[i]=24) { cout<<"O"; }else{ if(b[i]=25) { cout<<"P"; }else{ if(b[i]=26) { cout<<"Q"; }else{ if(b[i]=27) { cout<<"R"; }else{ if(b[i]=28) { cout<<"S"; }else{ if(b[i]=29) { cout<<"T"; }else{ if(b[i]=30) { cout<<"U"; }else{ if(b[i]=31) { cout<<"V"; }else{ if(b[i]=32) { cout<<"W"; }else{ if(b[i]=33) { cout<<"X"; }else{ if(b[i]=34) { cout<<"Y"; }else{ if(b[i]=35) { cout<<"Z"; } } } if(x!=0) { cout<<"."; } else { return 0; } for(int i=0; i<9; i++) { x=x*r; int xz=x; cout<<xz; x=x-xz; if(x==0) { break; } } }


Run Info:

Main.cc: In function 'int main()':
Main.cc:26:15: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
     if(b[i]=10) {
               ^
Main.cc:29:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      if(b[i]=11) {
                ^
Main.cc:32:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      if(b[i]=12) {
                ^
Main.cc:35:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      if(b[i]=13) {
                ^
Main.cc:38:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      if(b[i]=14) {
                ^
Main.cc:41:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      if(b[i]=15) {
                ^
Main.cc:44:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      if(b[i]=16) {
                ^
Main.cc:47:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      if(b[i]=17) {
                ^
Main.cc:50:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      if(b[i]=18) {
                ^
Main.cc:53:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      if(b[i]=19) {
                ^
Main.cc:56:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      if(b[i]=20) {
                ^
Main.cc:59:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      if(b[i]=21) {
                ^
Main.cc:62:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      if(b[i]=22) {
                ^
Main.cc:65:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      if(b[i]=23) {
                ^
Main.cc:68:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      if(b[i]=24) {
                ^
Main.cc:71:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      if(b[i]=25) {
                ^
Main.cc:74:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      if(b[i]=26) {
                ^
Main.cc:77:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      if(b[i]=27) {
                ^
Main.cc:80:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      if(b[i]=28) {
                ^
Main.cc:83:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      if(b[i]=29) {
                ^
Main.cc:86:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      if(b[i]=30) {
                ^
Main.cc:89:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      if(b[i]=31) {
                ^
Main.cc:92:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      if(b[i]=32) {
                ^
Main.cc:95:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      if(b[i]=33) {
                ^
Main.cc:98:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      if(b[i]=34) {
                ^
Main.cc:101:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      if(b[i]=35) {
                ^
Main.cc:120:1: error: expected '}' at end of input
 }
 ^
Main.cc:120:1: error: expected '}' at end of input
Main.cc:120:1: error: expected '}' at end of input
Main.cc:120:1: error: expected '}' at end of input
Main.cc:120:1: error: expected '}' at end of input
Main.cc:120:1: error: expected '}' at end of input
Main.cc:120:1: error: expected '}' at end of input
Main.cc:120:1: error: expected '}' at end of input
Main.cc:120:1: error: expected '}' at end of input
Main.cc:120:1: error: expected '}' at end of input
Main.cc:120:1: error: expected '}' at end of input
Main.cc:120:1: error: expected '}' at end of input
Main.cc:120:1: error: expected '}' at end of input
Main.cc:120:1: error: expected '}' at end of input
Main.cc:120:1: error: expected '}' at end of input
Main.cc:120:1: error: expected '}' at end of input
Main.cc:120:1: error: expected '}' at end of input
Main.cc:120:1: error: expected '}' at end of input
Main.cc:120:1: error: expected '}' at end of input
Main.cc:120:1: error: expected '}' at end of input
Main.cc:120:1: error: expected '}' at end of input
Main.cc:120:1: error: expected '}' at end of input
Main.cc:120:1: error: expected '}' at end of input
Main.cc:120:1: error: expected '}' at end of input
Main.cc:120:1: error: expected '}' at end of input
Main.cc:120:1: error: expected '}' at end of input