52 条题解
-
0
直接if嵌套。
#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; if(n/10000>=1&&n/10000<=9) { cout<<"wan"; } else if(n/100000>=1&&n/100000<=9) { cout<<"shi wan"; } else if(n/1000000>=1&&n/1000000<=9) { cout<<"bai wan"; } else if(n/10000000>=1&&n/10000000<=9) { cout<<"qian wan"; } else if(n/100000000>=1&&n/100000000<=9) { cout<<"yi"; } else if(n/1000000000>=1&&n/1000000000<=9) { cout<<"shi yi"; } return 0; }
先赞后看,养成习惯!
-
0
函数
#include <bits/stdc++.h> using namespace std; int n; int number(int a) //判断位数 { int sum = 0; while (a>0) { a/=10; sum++; } return sum; //sum储存:这个数有几位 } int main() { cin >> n; if (number(n) == 5) { cout << "wan"; } if (number(n) == 6) { cout << "shi wan"; } if (number(n) == 7) { cout << "bai wan"; } if (number(n) == 8) { cout << "qian wan"; } if (number(n) == 9) { cout << "yi"; } if (number(n) == 10) { cout << "shi yi"; } return 0; }
-
0
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if(n >= 10000 and n < 99999) { cout << "wan" << endl; } if(n >= 100000 and n < 999999) { cout << "shi wan" << endl; } if(n >= 1000000 and n < 9999999) { cout << "bai wan" << endl; } if(n >= 10000000 and n < 99999999) { cout << "qian wan" << endl; } if(n >= 100000000 and n < 999999999) { cout << "yi" << endl; } if(n >= 1000000000 and n < 9999999999) { cout << "shi yi" << endl; } return 0; }
-
0
全网最简代码 上代码!!!
#include <iostream> using namespace std; int main() { string m; cin>>m; if (m.length()==5) { cout<<"wan"; } else if (m.length()==6) { cout<<"shi wan"; } else if (m.length()==7) { cout<<"bai wan"; } else if (m.length()==8) { cout<<"qian wan"; } else if (m.length()==9) { cout<<"yi"; } else if (m.length()==10) { cout<<"shi yi"; } return 0; }
-
0
#include <iostream>//前方高能,前方高能。 using namespace std; int num; int main() { int n; cin >> n; while (n>0)//注意这里是whlie循环。 { n=n/10; num++; } if (num==5)//判断失控了! { cout << "wan"; } else if (num==6) { cout << "shi wan"; } else if (num==7) { cout << "bai wan"; } else if (num==8) { cout << "qian wan"; } else if (num==9) { cout << "yi"; } else if (num==10) { cout << "shi yi"; } return 0;//判断有那么亿点点长...... }//但是依然very easy。
-
0
很简单~~如果减去一个量级的数结果小于零,则此数低于此量级,用if-else if语句从低量级至高量级逐步查找即可(AC过的)
#include <iostream> using namespace std; int main() { int a; cin>>a; if (a-100000<0) { cout<<"wan"; } else if (a-1000000<0) { cout<<"shi wan"; } else if (a-10000000<0) { cout<<"bai wan"; } else if (a-100000000<0) { cout<<"qian wan"; } else if (a-1000000000<0) { cout<<"yi"; } else if (a-10000000000<0) { cout<<"shi yi"; } return 0; }
-
0
超级简单 现学现用 点一个赞 评论一下 养成习惯
#include<bits/stdc++.h> using namespace std; char s[9999]; int main(){ scanf("%s",s+1); int l=strlen(s+1); switch(l){ case 5: cout<<"wan"; break; case 6: cout<<"shi wan"; break; case 7: cout<<"bai wan"; break; case 8: cout<<"qian wan"; break; case 9: cout<<"yi"; break; case 10: cout<<"shi yi"; break; } return 0; }
-
0
ctrlC、ctrlV是真的香!AC通过!
#include<iostream> using namespace std; int main() { int n; cin>>n; if(n>=10000) { if(n<=99999) { cout<<"wan"; } } if(n>=100000) { if(n<=999999) { cout<<"shi wan"; } } if(n>=1000000) { if(n<=9999999) { cout<<"bai wan"; } } if(n>=10000000) { if(n<=99999999) { cout<<"qian wan"; } } if(n>=1000000000) { if(n<=9999999999) { cout<<"shi yi"; } } return 0; }
-
0
#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; if(n>10000 && n<99999){ cout<<"wan"; } else if(n>100000 && n<999999){ cout<<"shi wan"; } else if(n>1000000 && n<9999999){ cout<<"bai wan"; } else if(n>10000000 && n<99999999){ cout<<"qian wan"; } else if(n>100000000 && n<999999999){ cout<<"yi"; } else if(n>1000000000 && n<9999999999){ cout<<"shi yi"; } return 0; }
-
0
- 老方法还是最管用滴,(可借鉴,无需付赞)
#include <iostream> using namespace std; int main() { int n; cin >> n; if (n < 100000) { cout << "wan" << endl; } else if (n < 1000000) { cout << "shi wan" << endl; } else if (n < 10000000) { cout << "bai wan" << endl; } else if (n < 100000000) { cout << "qian wan" << endl; } else if (n < 1000000000) { cout << "yi" << endl; } else { cout << "shi yi" << endl; } return 0; }
-
0
#include <bits/stdc++.h> using namespace std; int main() { unsigned long long n;//就算9999999999也可以 cin >> n; //看他能整除谁 if (n / 1000000000 > 0) { cout << "shi yi"; return 0; } if (n / 100000000 > 0) { cout << "yi"; return 0; } if (n / 10000000 > 0) { cout << "qian wan"; return 0; } if (n / 1000000 > 0) { cout << "bai wan"; return 0; } if (n / 100000 > 0) { cout << "shi wan"; return 0; } if (n / 10000 > 0) { cout << "wan"; return 0; } return 0; }
-
0
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if(n >= 10000 and n < 99999) { cout << "wan" << endl; } if(n >= 100000 and n < 999999) { cout << "shi wan" << endl; } if(n >= 1000000 and n < 9999999) { cout << "bai wan" << endl; } if(n >= 10000000 and n < 99999999) { cout << "qian wan" << endl; } if(n >= 100000000 and n < 999999999) { cout << "yi" << endl; } if(n >= 1000000000 and n < 9999999999) { cout << "shi yi" << endl; } return 0; }
这道题很简单,疯狂写if就行了。代码不易,谢谢点赞!😄 别忘了点❤️ 在复制
-
0
这种多条件的题可以用这种三角形的代码解决,具体原理看前两层左右就能看明白了
#include <bits/stdc++.h> using namespace std; int main() { int n;cin>>n; if (n>=10000){ if(n>=100000){ if(n>=1000000){ if(n>=10000000){ if(n>=100000000){ if(n>=1000000000){ cout<<"shi yi"; } else{cout<<"yi";} } else{cout<<"qian wan";} } else{cout<<"bai wan";} } else{cout<<"shi wan";} } else{cout<<"wan";} } return 0; }
-
0
#include <iostream> using namespace std; int main() { long long n; cin >> n; if ((n/10000>0) && (n/10000<10)) { cout << "wan"; } if ((n/100000>0) && (n/100000<10)) { cout << "shi wan"; } if ((n/1000000>0) && (n/1000000<10)) { cout << "bai wan"; } if ((n/10000000>0) && (n/10000000<10)) { cout << "qian wan"; } if ((n/100000000>0) && (n/100000000<10)) { cout << "yi"; } if ((n/1000000000>0) && (n/1000000000<10)) { cout << "shi yi"; } return 0; }
-
0
这道题一如既往的简单
直接用字符串,数位问题。
数亿数有几位,(用 字符串变量名.length() 即可。),然后减四,得到另一个字符串数组(所有可能的结果)的索引值。
废话不多说,上代码!
#include<bits/stdc++.h> using namespace std; string x, y[7] = {"114514", "wan", "shi wan", "bai wan", "qian wan", "yi", "shi yi"}; int main() { cin >> x; cout << y[x.length() - 4] << endl; re turn 0; }
小盆友们,您学会了吗?
复制? 代码不易,先点赞,再复制吧! (不要忘了删倒数第二行的空格!)
-
0
这段代码其实非常简单,只要疯狂地使用if语句就可以了。 只要你有那么一点点耐心--(* @ *) --
#include <iostream> using namespace std; int main() { int n; cin >> n;//这是一个注释-- if (n / 10000 >= 1 and n / 10000 <= 9)//举个例子,10000(五位数中的最小数)除以10000 商为1。 99999(最大数)除以10000 商为9。 下面同样道理。。 { cout << "wan"; } if (n / 100000 >= 1 and n / 100000 <= 9) { cout << "shi wan"; } if (n / 1000000 >= 1 and n / 1000000 <= 9) { cout << "bai wan"; } if (n / 10000000 >= 1 and n / 10000000 <= 9) { cout << "qian wan"; } if (n / 100000000 >= 1 and n / 100000000 <= 9) { cout << "yi"; } if (n / 1000000000 >= 1 and n / 1000000000 <= 9) { cout << "shi yi"; } return 0; }
信息
- ID
- 319
- 时间
- 1000ms
- 内存
- 16MiB
- 难度
- 3
- 标签
- 递交数
- 4873
- 已通过
- 2630
- 上传者