Problem Description

珊珊開了一家體重管理中心。每當有新顧客上門,她就為她量體重。如果體重大於 50 公斤,她就免費送她一堂可以減一公斤的體驗課程。給你新顧客的體重,請輸出她離開中心時的體重。

The Input

輸入只有一行,其中含有一個正整數 w,代表新顧客進門的體重。

The Output

請輸出該顧客離開時的體重。

Sample Input

60

Sample Output

59

-----* Problem from【ZeroJudge, an Online Judge System For Beginners

My Answer

 
1
2
3
4
5
6
7
8
9
10
  #include<iostream>
using namespace std;
int main(void)
{
  int w;
  while(cin>>w){
    (w>50) ? cout<<w-1<<endl : cout<<w<<endl;
  }
  return 0;
}
 

 


arrow
arrow
    全站熱搜

    兔老大 發表在 痞客邦 留言(0) 人氣()