只有我不在的世界β
http://acm.hdu.edu.cn/contests/contest_showproblem.php?pid=1012&cid=832
Problem Description
In the world line 1.048596%
現(xiàn)在可不是失落的時(shí)候,自己還有能夠依靠的人。
麻衣一定會(huì)找到我的——梓川咲太如此堅(jiān)信著。
所以,他不會(huì)就這樣作為一個(gè)透明人活下去,他一定會(huì)很快回到原來(lái)的生活中,他必須按照原來(lái)的步調(diào)進(jìn)行生活。
課程只用上半天,就算是被世界遺忘的梓川咲太,也依舊認(rèn)真的上課,考試。
放學(xué)的班會(huì)結(jié)束后,也走向了從未進(jìn)入過(guò)的圖書室,開始翻看參考書。
咲太發(fā)現(xiàn)里面夾著一張紙條,但字跡卻并不是自己的。
“如果[a,b]表示a和b的最小公倍數(shù),那么[a,b]/a能得到多少個(gè)不同的數(shù)字呢?限制條件:a的范圍是1到1000。”
“這是最后一道問(wèn)題“
”若是那瞬間,那情景,對(duì)你而言是特殊的存在。”
“那么過(guò)往,就絕不會(huì)日漸遠(yuǎn)去。”
——Labmem No.004
到現(xiàn)在也不知道她是誰(shuí),為什么會(huì)幫助自己。也許和雙葉理央一樣,在遙遠(yuǎn)的未來(lái)為那些被青春期癥候群所折磨的人提供咨詢和幫助。
也許她也有青春期癥候群吧,命運(yùn)石之門什么的,不過(guò)那稱之為中二病更加貼切。
但也許就是長(zhǎng)不大的大人才能給長(zhǎng)不大的人帶來(lái)確切的幫助。
想必所謂的傷痕也好,孤獨(dú)也罷,終會(huì)化作至于他人的溫柔。
這個(gè)世界也一定是靠著這樣羈絆維持下去的。
?
?
Input
第一行輸入一個(gè)整數(shù)T(T<=50),代表有T組樣例。
對(duì)于每組樣例:
輸入一個(gè)數(shù)b(1<=b<=100000)
?
?
Output
對(duì)于每個(gè)b,輸出一個(gè)整數(shù),表示[a,b]/a可以得到多少個(gè)不同的數(shù)。
?
?
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 DEBUGusing 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 DEBUGfreopen("input.in", "r", stdin);//freopen("output.out", "w", stdout); #endifscanf("%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; }?
總結(jié)
- 上一篇: Complex Congratulati
- 下一篇: 在那天的雪停息之前β