2011年8月11日 星期四

[d073] 分組報告


內容 :

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

輸入說明 :

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

輸出該同學的組別。

範例輸入 :

7
範例輸出 :

3

/**********************************************************************************/
/* Problem: d073 "分組報告" from 板橋高中 */
/* Language: C */
/* Result: AC (4ms, 262KB) on ZeroJudge */
/* Author: diiuuli520 at 2009-04-04 00:22:02 */
/**********************************************************************************/


#include
#include

int main(void)
{
int a;

while(scanf("%d",&a)!=EOF)
if(a%3==0)
printf("%d",a/3);
else
printf("%d",a/3+1);
return(0);
}

沒有留言:

張貼留言