当前位置:网站首页>【暑期每日一题】洛谷 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;
} 边栏推荐
- OKR management process, how to implement effective dialogue, using the CFR feedback and recognition?
- [OpenCV] - Find and draw contours
- 高效回顾深度学习DL、CV、NLP
- 337. 打家劫舍 III
- 【OpenCV】-查找并绘制轮廓
- BaseDexClassLoader的正确使用方式
- "IP" command to configure network interface
- 2022高处安装、维护、拆除考试练习题及模拟考试
- LeetCode-从链表中删去总和值为零的连续结点
- 服务端修改Cookie——跨域cookie发送机——通信加密——异或加密
猜你喜欢

2分钟,带你走完企业经营分析全流程,更有通用分析框架直接套用

2022年安全员-A证特种作业证考试题库及在线模拟考试

杰理之开关降噪语音识别没有用【篇】

基因对疾病的影响规律--读论文

2022年低压电工练习题及模拟考试

软件质效领航者 | 优秀案例•东风集团DevOps改革项目

MySQL: Intent Shared Locks and Intentional Exclusive Locks | Deadlocks | Lock Optimization

MySQL: Implementation Principles of Submitted Read and Repeatable Read | MVCC (Multi-Version Concurrency Control) - Notes for Your Own Use

TASSEL软件导入plink格式文件报错

杰理之手机OTG问题【篇】
随机推荐
gopacket源码分析
Ali YunTianChi competition problem (machine learning) - O2O coupons prediction (complete code)
Integer multiple series
阿里云天池大赛赛题(机器学习)——O2O优惠券预测(完整代码)
MySQL: redo log log - notes for personal use
Construction and practice of full stack code test coverage and use case discovery system
Ridge regression and LASSO regression
Gopacket source code analysis
MySQL: Implementation Principles of Submitted Read and Repeatable Read | MVCC (Multi-Version Concurrency Control) - Notes for Your Own Use
模型包装,答辩吹牛方法论!
[Server data recovery] A case of data recovery when the Ext4 file system cannot be mounted and an error is reported after fsck
2022年安全员-A证特种作业证考试题库及在线模拟考试
钉钉与RStudio快捷方式冲突--钉钉快捷键设置
Polygon zkEVM Prover
ceph create pool, map, delete exercises
器件可靠性与温度的关系
松柏集(浮窗思)
杰理之SD卡切回蓝牙没有作用【篇】
Device Reliability vs. Temperature
AttributeError: partially initialized module ‘cv2‘ has no attribute ‘gapi_wip_gst_GStreamerPipeline‘