# 洛谷OJ-P4325 [COCI2006-2007#1] Modulo

## 题目描述

Given two integers A and B, A modulo B is the remainder when dividing A by B. For example, the numbers 7, 14, 27 and 38 become 1, 2, 0 and 2, modulo 3. Write a program that accepts 10 numbers as input and outputs the number of distinct numbers in the input, if the numbers are considered modulo 42.

## 输入输出格式

The input will contain 10 non-negative integers, each smaller than 1000, one per line.

Output the number of distinct values when considered modulo 42 on a single line.

###### 输入样例#2： 复制42842524201268404212684420输出样例#2： 复制1输入样例#3： 复制39404241438344828485输出样例#3： 复制6
#include <stdio.h>
#include <stdlib.h>
#define N 10
int temp[1000];//此处定义42个“桶”就行啦
int num[11];
int i,j,ans=0,c;
int main()
{
for(i=0;i<N;i++)
scanf("%d",&num[i]);//输入部分
for(j=0;j<N;j++)
{
c=num[j]%42;
temp[c]++;          //桶里面加一
}
for(i=0;i<42;i++)
{
if(temp[i]!=0)      //有些桶为1，有些桶>1,没出现过的为0
ans++;
}
printf("%d",ans);

return 0;
}

07-11 59

04-23 290
05-12 322
04-30
05-15 3233
05-16 4339
03-11 1万+
04-03 1685
06-28 158
11-29 164
11-03 1万+
08-26 9046
04-05 2792