1 条题解
-
0
C :
#include<string.h> #include<stdio.h> int main() { int m; char a[100]; scanf("%s",a); m=strlen(a); if(m==10) printf("shi yi"); if(m==9) printf("yi"); if(m==8) printf("qian wan"); if(m==7) printf("bai wan"); if(m==6) printf("shi wan"); if(m==5) printf("wan"); return 0; }C++ :
#include <iostream> using namespace std; int main() { long int n; cin>>n; if(n >= 10000 && n <= 9999999999) { if(n >= 10000 && n < 100000) cout<<"wan"; else if(n >= 100000 && n < 1000000) cout<<"shi wan"; else if(n >= 1000000 && n < 10000000) cout<<"bai wan"; else if(n >= 10000000 && n < 100000000) cout<<"qian wan"; else if(n >= 100000000 && n < 1000000000) cout<<"yi"; else cout<<"shi yi"; } return 0; }Pascal :
var a:string; b:longint; begin read(a); b:=length(a); if b=5 then write('wan') else if b=6 then write('shi wan') else if b=7 then write('bai wan') else if b=8 then write('qian wan') else if b=9 then write('yi') else write('shi yi'); end.Java :
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); long n = sc.nextInt(); int count = 0; while(n > 0){ n = n / 10; count++; } if(count == 10){ System.out.println("shi yi"); } if(count == 9){ System.out.println("yi"); } if(count == 8){ System.out.println("qian wan"); } if(count == 7){ System.out.println("bai wan"); } if(count == 6){ System.out.println("shi wan"); } if(count == 5){ System.out.println("wan"); } } }Python :
n = int(input()) if 10000 <= n < 100000: print('wan') elif 100000 <= n < 1000000: print('shi wan') elif 1000000 <= n < 10000000: print('bai wan') elif 10000000 <= n < 100000000: print('qian wan') elif 100000000 <= n < 1000000000: print('yi') elif 1000000000 <= n < 10000000000: print('shi yi')
- 1
信息
- ID
- 302
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者