I - Por Costel and the Pairs Gym - 100923I _思维啊——可惜我现在还没
2017-10-21 22:24
1051 查看
We don’t know how Por Costel the pig arrived at FMI’s dance party. All we know is that he did.
The dance floor is hot because Por Costel broke the air conditioner. On the dance floor, the boys and girls are clumsy. There are boys at the party. The -th one has clumsiness level . There ale also girls at the party. The -th girl has clumsiness level as well. Por Costel finds that a pair of a boy and a girl can dance only if the product of their clumsiness levels is at most , i.e. girl clumsiness level * boy clumsiness level . Por Costel thinks that a sack of oats with a slice of leek could make a better dancing pair than the people at this party. Nonetheless, he would like to find out how many pairs (boy, girl) can dance. The input will contain the number representing the number of tests. The next lines will contain the number .
Input
The input file perechi3.in will contain the number representing the number of tests. The next lines will each contain a single integer .
Output
The output file perechi3.out should have lines. Line should hold the answer for the -th test.
Example
input
11
1
4
5
10
100
99
16
64
49
50
48
output
1
8
10
27
482
473
50
280
201
207
198
题意: 有n个男的,n个女的,第i个人都有为当前一个大小为i的懒惰值,当一男一女懒惰值的乘积<=n他们就就可以一起跳舞,请问有多少种组合可能;
解:
第i个男人可以和前n/i个女人跳舞,女的也是这样,会有i个重复,但会多减一个坐标相同的加上就好
The dance floor is hot because Por Costel broke the air conditioner. On the dance floor, the boys and girls are clumsy. There are boys at the party. The -th one has clumsiness level . There ale also girls at the party. The -th girl has clumsiness level as well. Por Costel finds that a pair of a boy and a girl can dance only if the product of their clumsiness levels is at most , i.e. girl clumsiness level * boy clumsiness level . Por Costel thinks that a sack of oats with a slice of leek could make a better dancing pair than the people at this party. Nonetheless, he would like to find out how many pairs (boy, girl) can dance. The input will contain the number representing the number of tests. The next lines will contain the number .
Input
The input file perechi3.in will contain the number representing the number of tests. The next lines will each contain a single integer .
Output
The output file perechi3.out should have lines. Line should hold the answer for the -th test.
Example
input
11
1
4
5
10
100
99
16
64
49
50
48
output
1
8
10
27
482
473
50
280
201
207
198
题意: 有n个男的,n个女的,第i个人都有为当前一个大小为i的懒惰值,当一男一女懒惰值的乘积<=n他们就就可以一起跳舞,请问有多少种组合可能;
解:
第i个男人可以和前n/i个女人跳舞,女的也是这样,会有i个重复,但会多减一个坐标相同的加上就好
#include<bits/stdc++.h> using namespace std; #define ll long long int main() { freopen("perechi3.in","r",stdin); freopen("perechi3.out","w",stdout); ll t,n,i,j; cin>>t; { while(t--) { scanf("%lld",&n); ll ans=0,pos=0; for(i=1;i*i<=n;i++) { ans+=2*(n/i-i)+1; } printf("%lld\n", ans); } } return 0; }
相关文章推荐
- 【数形结合】Gym - 100923I - Por Costel and the Pairs
- 【Heap-dijkstra】Gym - 100923B - Por Costel and the Algorithm
- 【带权并查集】Gym - 100923H - Por Costel and the Match
- 【并查集】Gym - 100923H - Por Costel and the Match
- L - Por Costel and the Semipalindromes Gym - 100923L
- 【分块打表】Gym - 100923K - Por Costel and the Firecracker
- 【找规律】Gym - 100923L - Por Costel and the Semipalindromes
- A - Por Costel and Azerah Gym - 100923A
- 【动态规划】Gym - 100923A - Por Costel and Azerah
- A - Por Costel and Azerah Gym - 100923A
- Por Costel and Azerah Gym - 100923A
- Rasheda And The Zeriba Gym - 100283A 计算几何
- cf 862C Mahmoud and Ehab and the xor 思维+构造
- Gym 101343.J - Husam and the Broken Present 2(状压dp)
- GYM 100694 L.Hanoi Towers and the Progress(dp)
- Codeforces 682C Alyona and the Tree【Dfs+YY思维】好题
- codeforce 558B Amr and The Large Array 思维题
- [思维题] Ignatius and the Princess IV HDU - 1029
- B - Ignatius and the Princess IV 【思维】
- Codeforces Round #435 (Div. 2) C. Mahmoud and Ehab and the xor 【位运算+思维】