I - Por Costel and the Pairs

滴答滴答---题目链接 

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他们就就可以一起跳舞,请问有多少种组合可能;

看样例推出来的,上代码看就懂

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    long long ans,l;
    int i,n;
    freopen("perechi3.in","r",stdin);
    freopen("perechi3.out","w",stdout);
    scanf("%d",&t);
    while(t--)
    {
        ans=0;
        cin>>n;
        l=sqrt(n);
       for(i=1;i<=l;i++)
        ans+=n/i*2-l;
        cout<<ans<<endl;
    }
    return 0;
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值