当前位置:网站首页>【暑期每日一题】洛谷 P4325 [COCI2006-2007#1] Modulo
【暑期每日一题】洛谷 P4325 [COCI2006-2007#1] Modulo
2022-08-09 04:32:00 【AC_Dragon】
题目链接:P4325 [COCI2006-2007#1] Modulo - 洛谷 | 计算机科学教育新生态 (luogu.com.cn)
题面翻译
题目描述
给出10个整数,问这些整数%42后有多少个不同的余数。
输入
输入包含10个小于1000的非负整数,每行一个。
输出
输出它们%42后,有多少个不同的余数。
说明
第一个样例的十个结果是1,2,3,4,5,6,7,8,9,10,有10个不同的结果;第二个样例结果都是0,只有一个不同的结果;第三个样例余数是39,40,41,0,1,2,40,41,0,1,有0,1,2,39,40,41这六个不同的结果。
感谢@ACdreamer 提供的翻译
注明:%42为除以42取余
题目描述
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.
样例 #1
样例输入 #1
1
2
3
4
5
6
7
8
9
10
样例输出 #1
10
样例 #2
样例输入 #2
42
84
252
420
840
126
42
84
420
126
样例输出 #2
1
样例 #3
样例输入 #3
39
40
41
42
43
44
82
83
84
85
样例输出 #3
6
提示
In the first example, the numbers modulo 42 are 1, 2, 3, 4, 5, 6, 7, 8, 9 and 10.
In the second example all numbers modulo 42 are 0.
In the third example, the numbers modulo 42 are 39, 40, 41, 0, 1, 2, 40, 41, 0 and 1. There are 6 distinct numbers.
AC code:
#include<iostream>
#include<algorithm>
#include<set>
using namespace std;
int main()
{
set<int> a;
for(int i=0;i<10;i++)
{
int x;
cin>>x;
a.insert(x%42);
}
cout<<a.size();
return 0;
}
边栏推荐
- OpenMLDB + Jupyter Notebook:快速搭建机器学习应用
- 供应商对接Chewy的EDI需求
- OKR management process, how to implement effective dialogue, using the CFR feedback and recognition?
- 【数学】点积与叉积
- 岭回归和LASSO回归
- 松柏集(浮窗思)
- 使用Oracle SQL Developer管理Oracle Database Express Edition (XE)
- AttributeError: partially initialized module ‘cv2‘ has no attribute ‘gapi_wip_gst_GStreamerPipeline‘
- The influence law of genes for disease - read the paper
- 杰理之采用mix out eq 没有作用【篇】
猜你喜欢
使用Oracle SQL Developer管理Oracle Database Express Edition (XE)
数量遗传学遗传力计算2:半同胞和全同胞
串扰与防护
Alibaba Cloud Tianchi Contest Question (Machine Learning) - Repeat Purchase Prediction of Tmall Users (Complete Code)
杰理之智能充电仓低电发码关机 触摸不开机【篇】
模型包装,答辩吹牛方法论!
MySQL:已提交读和可重复读的实现原理 | MVCC(多版本并发控制)——笔记自用
etcd Study Notes - Getting Started
LeetCode - remove consecutive nodes with a sum of zero from a linked list
松柏集(夜未央)
随机推荐
松柏集(云衣裳)
FFmpeg编译支持x264/openH264/dash
STM32串口通信不停接受到垃圾数据的问题及其解决
Win11一键重装系统后如何使用自带的故障检测修复功能
配置网络接口的“IP“命令
Alibaba Cloud Tianchi Contest Question (Machine Learning) - Prediction of Industrial Steam Volume (Complete Code)
2022高压电工考试试题及答案
LeetCode题解—15.三数之和
消失的遗传力--wiki
2022 Security Officer-B Certificate Exam Practice Questions and Online Mock Exam
杰理之电话打入,远端听不到声音【篇】
ceph创建存储池,映射,删除练习
Efficient review of deep learning DL, CV, NLP
OKR management process, how to implement effective dialogue, using the CFR feedback and recognition?
MySQL:意向共享锁和意向排它锁 | 死锁 | 锁的优化
P1163 银行贷款
EDI对接 New York & Company案例
2022年熔化焊接与热切割考试模拟100题及在线模拟考试
HyperLynx(四)差分传输线模型
串扰与防护