GCD SUM

Time Limit: 8000/4000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others)

Problem Description

给出N,M,执行如下程序:
long long  ans = 0, ansx = 0, ansy = 0;
for(int i = 1; i <= N; i++)
   for(int j = 1; j <= M; j++)
       if(gcd(i,j) == 1) ans++, ansx += i, ansy += j;
cout << ans << " " << ansx << " " << ansy << endl;

Input

多组数据,每行两个数N,M(1 <= N,M <= 100000)。

Output

如题所描述,每行输出3个数,ans,ansx,ansy,空格隔开

Sample Input

5 5
1 3

Sample Output

19 55 55
3 3 6

Hint

总数据小于50000

Source

dream

Manager

Information
Solved Number74
Submit Number388
Problem Tags
games
math
number theory
No tag edit access
温馨提示:AC后可以编辑标签哦. ^-^
Login
LoginCancel