1 条题解
-
0
C :
#include <stdio.h> void main() { int x,p; scanf("%d",&x); if(x>=90) { p=x*3; }else if(x>=80&&x<90){ p=x*2; }else if(x>=70&&x<80){ p=x; }else{ p=50; } printf("%d",p); }C++ :
#include <iostream> using namespace std; int main(){ //s代表成绩(score),m代表零花钱的金额(money) int s,m; cin>>s; //判断各个分支 if(s >= 90){ m = s * 3; } else if(s >= 80 && s < 90){ m = s * 2; } else if(s >= 70 && s < 80){ m = s; } else{ m = 50; } cout<<m<<endl; }Pascal :
var a:longint; begin read(a); if a>=90 then write(a*3); if (a<90) and (a>=80) then write(a*2); if (a<80) and (a>=70) then write(a); if a<70 then write('50'); end.Java :
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int s = 0 ; if(a>=90) { s = a * 3 ; System.out.println(s); }else if(a>=80 && a<90) { s = a * 2 ; System.out.println(s); }else if(a>=70 && a<80) { s = a ; System.out.println(s); }else { System.out.println(50); } } }Python :
n=int(input()) if n>=90: print(n*3) elif n>=80 and n<90: print(n*2) elif n>=70 and n<80: print(n) else: print(50)
- 1
信息
- ID
- 280
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者