日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

A. 这是一道简单的水题~

發布時間:2023/12/20 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 A. 这是一道简单的水题~ 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

A. 這是一道簡單的水題~

pbz最近沉浸在數學中無法自拔,他發現了一種非常有趣的數,這個數的十進制表示形式中只含有8和9,這個數有著很好的寓意,代表了pbz的夢想和期望,他想知道對于任意的給定的正整數N,有多少個正整數M使得N*M所得得數是pbz所想要的數。
Input
第一行給出一個T,表示有T組案例,每個測試用例由一行組成,每行輸入一個正整數N(1<=N*M<=1e10)

Output
對于每個輸入的N,按升序輸出所有符合條件的M,如果M不存在的話就輸出“\This is not of value!\”。

Sample Input
2
5
9
Sample Output
\This is not of value!\
1
11
111
1111
11111
111111
1111111
11111111
98765432
111111111
987654321
987654322
987654332
987654432
987655432
987665432
987765432
988765432
998765432
1098765432
1111111111

只有 8 9 兩個選擇bfs就好

#include<iostream> #include<cstdio> #include<cmath> #include<cstring> #include<string> #include<algorithm> #include<stack> #include<queue> #include<cctype> #include<functional> using namespace std; #define swap(a,b) {long long c=a;a=b;b=c;} const int MAX = 999999; const double Eps = 1e-12; const double PI = acos(-1.0); int gcd(int x, int y) {return x%y == 0 ? y : gcd(y, x%y); } long long num[1000005] = { 8,9 }; long long j; int main() {j = 2;long long i;for ( i = 0;;i++){num[j++] = num[i] * 10 + 8;if (num[j - 1]>10000000000)break;num[j++] = num[i] * 10 + 9;if (num[j - 1]>10000000000)break;}int t;scanf("%d", &t);while (t--){long long n;scanf("%lld", &n);int flag = 0;for (int i = 0;i<j;i++){if (num[i] % n == 0 && num[i] <= 1e+10){flag = 1;printf("%lld\n", num[i] / n);}if (num[i]>10000000000)break;}if (flag==0) printf("\\This is not of value!\\\n");}return 0; }

總結

以上是生活随笔為你收集整理的A. 这是一道简单的水题~的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。