2 条题解
-
2
超笨写法
#include<bits/stdc++.h> using namespace std; int main(){ int n;cin>>n; if(n<10){ if(n==0) cout<<"ling"; if(n==1) cout<<"yi"; if(n==2) cout<<"er"; if(n==3) cout<<"san"; if(n==4) cout<<"si"; if(n==5) cout<<"wu"; if(n==6) cout<<"liu"; if(n==7) cout<<"qi"; if(n==8) cout<<"ba"; if(n==9) cout<<"jiu"; }else{ if(n%10==0){ if(n==10) cout<<"shi"; if(n==20) cout<<"er shi"; if(n==30) cout<<"san shi"; if(n==40) cout<<"si shi"; if(n==50) cout<<"wu shi"; if(n==60) cout<<"liu shi"; if(n==70) cout<<"qi shi"; if(n==80) cout<<"ba shi"; if(n==90) cout<<"jiu shi"; }else{ int g=n%10;int s=n/10; if(s==1) cout<<"shi "; if(s==2) cout<<"er shi "; if(s==3) cout<<"san shi "; if(s==4) cout<<"si shi "; if(s==5) cout<<"wu shi "; if(s==6) cout<<"liu shi "; if(s==7) cout<<"qi shi "; if(s==8) cout<<"ba shi "; if(s==9) cout<<"jiu shi "; if(g==0) cout<<"shi"; if(g==1) cout<<"yi"; if(g==2) cout<<"er"; if(g==3) cout<<"san"; if(g==4) cout<<"si"; if(g==5) cout<<"wu"; if(g==6) cout<<"liu"; if(g==7) cout<<"qi"; if(g==8) cout<<"ba"; if(g==9) cout<<"jiu"; } } return 0; }
-
1
已
WAAC,放心食用#include <bits/stdc++.h> using namespace std; string shift(int n) { if(n == 0)return "ling"; else if(n == 1)return "yi"; else if(n == 2)return "er"; else if(n == 3)return "san"; else if(n == 4)return "si"; else if(n == 5)return "wu"; else if(n == 6)return "liu"; else if(n == 7)return "qi"; else if(n == 8)return "ba"; else if(n == 9)return "jiu"; } int main() { int n; cin >> n; if(n < 10) { cout << shift(n); } else if(n == 10) { cout << "shi"; } else if(n < 20) { cout << "shi " << shift(n % 10); } else { if(n % 10 == 0) { cout << shift(n / 10) << " shi"; } else { cout << shift(n / 10) << " shi " << shift(n % 10); } } return 0; }
- 1
信息
- ID
- 240
- 时间
- 1000ms
- 内存
- 16MiB
- 难度
- 1
- 标签
- 递交数
- 37
- 已通过
- 28
- 上传者