HDU4768 Flyer
来源:互联网 发布:魔兽世界mac版插件 编辑:程序博客网 时间:2024/06/06 00:06
Flyer
问题描述 :
The new semester begins! Different kinds of student societies are all trying to advertise themselves, by giving flyers to the students for introducing the society. However, due to the fund shortage, the flyers of a society can only be distributed to a part of the students. There are too many, too many students in our university, labeled from 1 to 2^32. And there are totally N student societies, where the i-th society will deliver flyers to the students with label A_i, A_i+C_i,A_i+2*C_i,…A_i+k*C_i (A_i+k*C_i<=B_i, A_i+(k+1)*C_i>B_i). We call a student "unlucky" if he/she gets odd pieces of flyers. Unfortunately, not everyone is lucky. Yet, no worries; there is at most one student who is unlucky. Could you help us find out who the unfortunate dude (if any) is? So that we can comfort him by treating him to a big meal!
输入:
There are multiple test cases. For each test case, the first line contains a number N (0 < N <= 20000) indicating the number of societies. Then for each of the following N lines, there are three non-negative integers A_i, B_i, C_i (smaller than 2^31, A_i <= B_i) as stated above. Your program should proceed to the end of the file.
输出:
There are multiple test cases. For each test case, the first line contains a number N (0 < N <= 20000) indicating the number of societies. Then for each of the following N lines, there are three non-negative integers A_i, B_i, C_i (smaller than 2^31, A_i <= B_i) as stated above. Your program should proceed to the end of the file.
样例输入:
21 10 12 10 145 20 76 14 35 9 17 21 12
样例输出:
1 18 1
#include <iostream>using namespace std;const int N = 20010;long long a[N], b[N], c[N];int main(){ int n; while(cin>>n){ long long num = 0; for(int i = 1; i <= n; i++){ cin>>a[i]>>b[i]>>c[i]; for(long long j = a[i]; j <= b[i]; j+=c[i]){ num ^= j; } } long long sum = 0; for(int i = 1; i <= n; i++){ if((num-a[i])%c[i]==0 && (num>=a[i])&&(num<=b[i])) sum++; } if(num==0){ cout<<"DC Qiang is unhappy."<<endl; continue; } cout << num << " " << sum << endl; } return 0;}
0 0
- HDU4768 Flyer
- HDU4768:Flyer(二分)
- Flyer(二分 HDU4768)
- HDU4768 Flyer 二分
- HDU4768:Flyer(二分)
- HDU4768:Flyer(二分)
- HDU4768 Flyer 二分|异或的性质|暴力
- HDU4768
- 2013 ACM/ICPC Asia Regional Changchun Online Problem J & hdu4768 Flyer(二分)
- Flyer
- HDU4768(二分)
- hdu4768 二分
- Flyer test
- HDOJ4768 Flyer
- hdu4768(二分)
- hdu4768(二分)
- hdu4768 非常规的二分
- HDU 4768 Flyer
- 数字金字塔
- sql学习日志
- 冬训练习5
- 欢迎使用CSDN-markdown编辑器
- Annaconda 增加删除镜像 channel
- HDU4768 Flyer
- Google VR技术大揭秘
- Matlab数据的可视化 -- 简易表面图
- 讲故事的和尚被打断了
- SSL 1376——完全背包
- 实现一个公用的自定义UITableviewCell
- 流量控制和拥塞控制
- JavaScript中的this关键字的用法和注意点
- poj3046(动态规划)优化