[csu1392]YY一下
2015-04-12 06:45
429 查看
题意:给定x,求有多少个10^8以内的数满足这个数乘以x以后,最高位到了最低位。设最高位的数字和剩余长度,列等式推理即可。
View Code
#pragma comment(linker, "/STACK:10240000,10240000") #include <iostream> #include <cstdio> #include <algorithm> #include <cstdlib> #include <cstring> #include <map> #include <queue> #include <deque> #include <cmath> #include <vector> #include <ctime> #include <cctype> #include <set> using namespace std; #define mem0(a) memset(a, 0, sizeof(a)) #define lson l, m, rt << 1 #define rson m + 1, r, rt << 1 | 1 #define define_m int m = (l + r) >> 1 #define Rep(a, b) for(int a = 0; a < b; a++) #define lowbit(x) ((x) & (-(x))) #define constructInt4(name, a, b, c, d) name(int a = 0, int b = 0, int c = 0, int d = 0): a(a), b(b), c(c), d(d) {} #define constructInt3(name, a, b, c) name(int a = 0, int b = 0, int c = 0): a(a), b(b), c(c) {} #define constructInt2(name, a, b) name(int a = 0, int b = 0): a(a), b(b) {} typedef double db; typedef long long LL; typedef pair<int, int> pii; typedef multiset<int> msi; typedef multiset<int>::iterator msii; typedef set<int> si; typedef set<int>::iterator sii; typedef vector<int> vi; const int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1}; const int dy[8] = {0, -1, 0, 1, -1, 1, 1, -1}; const int maxn = 1e5 + 7; const int maxm = 1e5 + 7; const int maxv = 1e7 + 7; const int MD = 1e9 +7; const int INF = 1e9 + 7; const double PI = acos(-1.0); const double eps = 1e-10; int digit(LL x) { int cnt = 0; while (x) { cnt++; x /= 10; } return cnt; } int main() { //freopen("in.txt", "r", stdin); double tx; while (cin >> tx) { LL x = (int)(tx * 10000 + 0.5), get = 0; if (x >= 100000) { puts("No solution"); continue; } LL p = 1; for (int i = 0; i <= 7; i++) { for (int k = 1; k <= 9; k++) { LL tmp = k * (x * p - 1e4); if (tmp % (LL)(1e5 - x)) continue; tmp /= 1e5 - x; if (digit(tmp) == i) { printf("%d", k); if (tmp > 0) printf("%d", tmp); puts(""); get = 1; } } p *= 10; } if (!get) puts("No solution"); } return 0; }
View Code
相关文章推荐
- YY一下给数组加上getter和setter会是怎样的效果
- 博客访问量两万,再发个贴YY一下
- Appium自动化测试系列2- 写一个Python测试脚本来测试一下YY语音
- YY一下,看到美女换裤子
- YY一下微信线下支付的场景
- codeforces 143 C.To Add or Not to Add (YY 二分 处理一下前缀和)
- YY一下微信线下支付的场景
- csu 1392 Number Trick (数论)
- CSU 1082: 憧憬一下集训 (线段树 扫描线)
- YY一下
- CSU1392(NCPC2013)_Number Trick
- 再YY一下P2P的爬虫吧
- YY一下淘宝商品模型
- 【python】YY一下python里的 True 和 False
- 线段树 csu1082 憧憬一下集训
- SGU 520 Fire in the Country 博弈SG函数(或者YY一下)
- 第一次收到苹果的钱YY一下
- DBA 路途遥远,自己YY一下了……zz FROM: 百度百科
- YY一下IT业的未来
- YY一下如何快速学习<Thinking in Java>这本书