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;
執行以下程序:
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)。ios
Output
如題所描述,每行輸出3個數,ans,ansx,ansy,空格隔開
Sample Input
5 5
1 3
Sample Output
19 55 55
3 3 6