Problem Description

電腦課要同學分組做期末報告,分組的方式為依座號順序,每 3 個人一組。如:1, 2, 3 為第一組,4, 5, 6 為第二組….以此類推。輸入同學的座號,請判斷他在哪一組。

Input Format

輸入只有一行,含有一個正整數 n,代表同學的座號。

Output Format

輸出該同學的組別。

Sample Input

7

Sample Output

3


-----*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 n;
   while(cin>>n){
      (n%3!=0) ? cout<<n/3+1<<endl : cout<<n/3<<endl;
   }
   return 0;
}


 


arrow
arrow
    全站熱搜

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