Visible Trees Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1951 Accepted Submission(s): 792 Problem Description There are many trees forming a m * n grid, the grid starts from (1,1). Farm…
GCD Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 7529 Accepted Submission(s): 2773 Problem Description Given 5 integers: a, b, c, d, k, you're to find x in a...b, y in c...d that GCD(x, y…
Problem Description Given a number N, you are asked to count the number of integers between A and B inclusive which are relatively prime to N.Two integers are said to be co-prime or relatively prime if they have no common positive divisors other than…
C - Visible Trees HDU - 2841 思路 :被挡住的那些点(x , y)肯定是 x 与 y不互质.能够由其他坐标的倍数表示,所以就转化成了求那些点 x,y互质 也就是在 1 - m 1 - n 中找互质的对数,容斥 求一下即可 #include<bits/stdc++.h> using namespace std; #define ll long long #define maxn 123456 bool vis[maxn+10]; ll t,n,m,prime[m…
H - Visible Trees Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Practice HDU 2841 Description There are many trees forming a m * n grid, the grid starts from (1,1). Farmer Sherlock is standing at (0,0) poi…
Visible Trees Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Description There are many trees forming a m * n grid, the grid starts from (1,1). Farmer Sherlock is standing at (0,0) point. He wonders how ma…
原文链接 There are many trees forming a m * n grid, the grid starts from (1,1). Farmer Sherlock is standing at (0,0) point. He wonders how many trees he can see. If two trees and Sherlock are in one line, Farmer Sherlock can only see the tree nearest to…
/** 大意: 求[1,m], [1,n] 之间有多少个数互素...做了 1695 ,,这题就so easy 了 **/ #include <iostream> #include <cmath> #include <algorithm> using namespace std; ; long long phi[maxn]; long long priD[maxn]; int len ; void euler(long long n){ long long m = (in…
GCD Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4141 Accepted Submission(s): 1441 Problem Description Given 5 integers: a, b, c, d, k, you're to find x in a...b, y in c...d that GCD(x, y)…
How many integers can you find Time Limit: 12000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 3315 Accepted Submission(s): 937 Problem Description Now you get a number N, and a M-integers set, you shoul…
Co-prime Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 935 Accepted Submission(s): 339 Problem Description Given a number N, you are asked to count the number of integers between A and B in…
B. Pasha and Phone Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/595/problem/B Description Pasha has recently bought a new phone jPager and started adding his friends' phone numbers there. Each phone number consists of ex…
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3556 How Many Sets I Time Limit: 2 Seconds Memory Limit: 65536 KB Give a set S, |S| = n, then how many ordered set group (S1, S2, ..., Sk) satisfies S1 ∩ S2 ∩ ... ∩ Sk = ∅. (Si is…
Description As we all know caterpillars love to eat leaves. Usually, a caterpillar sits on leaf, eats as much of it as it can (or wants), then stretches out to its full length to reach a new leaf with its front end, and finally "hops" to it by c…
When ?? was born, seven crows flew in and stopped beside him. In its childhood, ?? had been unfortunately fall into the sea. While it was dying, seven dolphins arched its body and sent it back to the shore. It is said that ?? used to surrounded by 7…