只有我不在的世界β

1012 篇文章 43 订阅

http://acm.hdu.edu.cn/contests/contest_showproblem.php?pid=1012&cid=832

Problem Description

In the world line 1.048596%

现在可不是失落的时候,自己还有能够依靠的人。

麻衣一定会找到我的——梓川咲太如此坚信着。

所以,他不会就这样作为一个透明人活下去,他一定会很快回到原来的生活中,他必须按照原来的步调进行生活。

课程只用上半天,就算是被世界遗忘的梓川咲太,也依旧认真的上课,考试。

放学的班会结束后,也走向了从未进入过的图书室,开始翻看参考书。

咲太发现里面夹着一张纸条,但字迹却并不是自己的。

“如果[a,b]表示a和b的最小公倍数,那么[a,b]/a能得到多少个不同的数字呢?限制条件:a的范围是1到1000。”

“这是最后一道问题“

”若是那瞬间,那情景,对你而言是特殊的存在。”

“那么过往,就绝不会日渐远去。”

——Labmem No.004

到现在也不知道她是谁,为什么会帮助自己。也许和双叶理央一样,在遥远的未来为那些被青春期症候群所折磨的人提供咨询和帮助。

也许她也有青春期症候群吧,命运石之门什么的,不过那称之为中二病更加贴切。

但也许就是长不大的大人才能给长不大的人带来确切的帮助。

想必所谓的伤痕也好,孤独也罢,终会化作至于他人的温柔。

这个世界也一定是靠着这样羁绊维持下去的。

 

 

Input

第一行输入一个整数T(T<=50),代表有T组样例。

对于每组样例:

输入一个数b(1<=b<=100000)

 

 

Output

对于每个b,输出一个整数,表示[a,b]/a可以得到多少个不同的数。

 

 

Sample Input

 

1 4

 

 

Sample Output

 

3

C++版本一

模拟???

/*
*@Author:   STZG
*@Language: C++
*/
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
#include<list>
#include<map>
#include<set>
//#define DEBUG

using namespace std;
typedef long long ll;
const int N=10000;
const double PI = acos(-1.0);
const double EXP = 1E-8;
const int INF = 0x3f3f3f3f;
int t,n,m;
int gcd(int a,int b){
    if(a>b){
        int t=a;
        a=b;
        b=t;
    }
    while(b!=0){
        int r=a%b;
        a=b;
        b=r;
    }
return a;
} int sum[100100];
int main()
{
#ifdef DEBUG
	freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
#endif
    scanf("%d",&t);
    while(t--){
        scanf("%d",&n);
        int ans=0;
        memset(sum,0,sizeof(sum));
        for(int i=1;i<=1000;i++){
            sum[n/gcd(i,n)]++;
        }
        for(int i=1;i<=100000;i++){
            if(sum[i])
                ans++;
        }
        cout << ans << endl;
    }

    //cout << "Hello world!" << endl;
    return 0;
}

C++版本二

https://www.cnblogs.com/MingSD/p/10050324.html

#include<bits/stdc++.h>
using namespace std;
#define Fopen freopen("_in.txt","r",stdin); freopen("_out.txt","w",stdout);
#define LL long long
#define ULL unsigned LL
#define fi first
#define se second
#define pb push_back
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define lch(x) tr[x].son[0]
#define rch(x) tr[x].son[1]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
typedef pair<int,int> pll;
const int inf = 0x3f3f3f3f;
const LL INF = 0x3f3f3f3f3f3f3f3f;
const LL mod =  (int)1e9+7;
const int N = 1e5 + 100;
set<int> s;
int main(){
    int T;
    scanf("%d", &T);
    while(T--){
        int b;
        scanf("%d", &b);
        for(int i = 1; i <= 1000; ++i){
            int tmp = b/__gcd(b,i);
            s.insert(tmp);
        }
        cout << s.size() << endl;
        s.clear();
    }
    return 0;
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Starzkg

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值