a053.計分程式
a053.計分程式
| 解題思路 : 設題數為n,判斷n的區間,輸出相對應分數
| 程式碼 :
/*
a053 計分程式
skyblue
https://zerojudge.tw/ShowProblem?problemid=a053
AC (2ms, 356KB)
*/
#include <bits/stdc++.h>
using namespace std;
int main(){
//輸入輸出加速語法
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
if(n<=10)
cout << n*6 <<"\n";
if((n>= 11) && (n<=20))
cout << 60 + (n-10)*2 <<"\n";
if((n>= 21) && (n<=40))
cout << 80 + (n-20) <<"\n";
if(n>40)
cout << 100<<"\n";
return 0;
}
留言
張貼留言