解题思路:
注意事项:
参考代码:
#include<iostream> #include<cmath> using namespace std; int main() { int n; while(cin>>n) { for(int a=9; a<=11; a++) for(int b=9; b<=11; b++) for(int c=9; c<=11; c++) for(int d=9; d<=11; d++) for(int e=9; e<=11; e++) for(int f=9; f<=11; f++) for(int g=9; g<=11; g++) for(int h=9; h<=11; h++) for(int i=9; i<=11; i++) for(int j=9; j<=11; j++) if(a+b*3+c*9+d*27+e*81+f*pow(3,5)+g*pow(3,6)+h*pow(3,7)+i*pow(3,8)+j*pow(3,9)==n) { cout<<a<<' '<<b<<' '<<c<<' '<<d<<' '<<e<<' '<<f<<' '<<g<<' '<<h<<' '<<i<<' '<<j<<endl; break; } } return 0; }
0.0分
1 人评分
数字游戏 (C++代码)浏览:1202 |
1050题解(结构体数组与结构体指针的使用)浏览:1122 |
C二级辅导-等差数列 (C语言代码)浏览:737 |
C语言程序设计教程(第三版)课后习题7.4 (C语言代码)浏览:493 |
矩阵转置 (C语言代码)浏览:793 |
杨辉三角 (C语言代码)浏览:682 |
C二级辅导-公约公倍 (C语言代码)浏览:1313 |
C语言程序设计教程(第三版)课后习题6.5 (C语言代码)浏览:703 |
删除数组中的0元素 (C语言代码)浏览:2065 |
C语言程序设计教程(第三版)课后习题6.4 (C语言代码)浏览:464 |