题目链接:http://www.codeforces.com/problemset/problem/148/A题意:求1到d中有多少个数能被k,l,m,n中的至少一个数整出.C++代码: #include <iostream> using namespace std; int k, l, m, n, d, ans; int main() { cin >> k >>l >> m >> n >> d; ; i <= d; i ++)…
公主睡前数龙, 每隔k, l, m, n只都会用不同的技能攻击龙. 假定共数了d只龙, 问共有多少龙被攻击了. 思路: 用一个visit数组记录被攻击过的dragon, 最后遍历visit数组统计被攻击过的龙即可. #define MAXN 100005 using namespace std; int visited[MAXN]; // index from 1 void attack(int c, int d) { int f = d/c; ; i <= f; i++) visited[c*…
Problem description «One dragon. Two dragon. Three dragon», — the princess was counting. She had trouble falling asleep, and she got bored of counting lambs when she was nine. However, just counting dragons was boring as well, so she entertained hers…
A. Insomnia cure 哎 只能说英语太差,一眼题我看了三分钟. 题意:给5个数k, l, m, n 和 d,求1~d中能被k, l, m, n 至少一个整除的数的个数. 题解:…… 代码: #include <iostream> using namespace std; int main() { int a, b, c, d, n; cin >> a >> b >> c >> d >> n; ; ; i <= n;…
题目链接:http://acm.hdu.edu.cn/contests/contest_showproblem.php?pid=1002&cid=723 Cure Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7400 Accepted Submission(s): 1099 Problem Description Given a…
Cure Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1333 Accepted Submission(s): 440 Problem Description Given an integer n, we only want to know the sum of 1/k2 where k from 1 to n. Input…