[ICPC2016Dalian Onsite]D. A Simple Math Problem 作者: rin 时间: October 19, 2016 分类: Algo 评论 **Time Limited:1 Sec Memory Limited: 64M** ###Description Given two positive integers $$a$$ and $$b$$, find suitable $$X$$ and $$Y$$ to meet the conditions: $$X+Y=a$$ $$Least Common Multiple(X,Y)=b$$ :hj-ovo: ###Input Input includes multiple sets of test data, Each test data occupies one line, including two positive integers $$a(1\leq a\leq 2*10^{4})$$, $$b(1\leq b\leq 10^{9})$$, and their meanings are shown in the description. Contains most of the 12W test cases. ###Output For each set of input data, output a line of two integers, representing $$X$$, $$Y$$. If you cannot find such $$X$$ and $$Y$$, output one line of "No Solution"(without quotation). ###Sample Input ``` 6 8 798 10780 ``` ###Sample Output ``` No Solution 308 490 ``` - 阅读剩余部分 -
Happy 2012/2004 作者: rin 时间: October 24, 2015 分类: Algo 评论 [http://acm.bjfu.edu.cn/acmhome/problemdetail.do?&method=showdetail&id=1087](http://acm.bjfu.edu.cn/acmhome/problemdetail.do?&method=showdetail&id=1087 "http://acm.bjfu.edu.cn/acmhome/problemdetail.do?&method=showdetail&id=1087") ###描述 Consider a positive integer X,and let S be the sum of all positive integer divisors of 2012^X. Your job is to determine S modulo 29 (the rest of the division of S by 29). Take X = 1 for an example. The positive integer divisors of 2012^1 are 1, 2, 4, 503, 1006 and 2012. Therefore S = 3528 and S modulo 29 is equal to 19. ###输入 The input consists of several test cases. Each test case contains a line with the integer X (1 <= X <= 1000000). A test case of X = 0 indicates the end of input, and should not be processed. ###输出 For each test case, in a separate line, please output the result of S modulo 29. ###样例输入 ``` 1 100000 ``` ###样例输出 ``` 19 2 ``` 题目大意是 给定一个$$X$$,求$$2012^{X}$$所有因数的和,结果模上29 记 $$S(n)$$ 为 $$n$$ 的所有因数之和,有: ```math \begin{array}{l} S(2)=1+2=3 \\ S(3)=1+3=4 \\ S(4)=1+2+4=7 \\ S(5)=1+5=6 \\ S(6)=1+2+3+6=12 \\ S(7)=1+7=8 \\ S(8)=1+2+4+8=15 \\ S(9)=1+3+9=13 \\ S(10)=1+2+5+10=18 \\ \qquad ... \\ S(14)=1+2+7+14=24 \\ S(15)=1+3+5+15=24 \\ S(16)=1+2+8+16=27 \\ \qquad \cdots \\ S(24)=1+2+3+4+6+8+12+24=60 \\ \qquad \cdots \\ S(30)=1+2+3+5++6+10+15+30=72 \\ \qquad \cdots \\ \end{array} ``` 由 观察 naodong 有: ```math \begin{array}{l} \qquad \cdots \\ S(6)=S(2)\times S(3)=12 \\ S(10)=S(2)\times S(5)=18 \\ S(14)=S(2)\times S(7)=24\\ S(15)=S(3)\times S(5)=24\\ S(24)=S(3)\times S(8)=60 \end{array} ``` - 阅读剩余部分 -