标签:class lse name namespace pac else int bsp ++
#include<iostream> #include<string> using namespace std; int gcd(int a, int b) { if (b == 0) return a; else return gcd(b, a % b); } int main() { int a, b,i,j,k=0; cin >> a >> b; if (a < b) { for (i = a; i < b; i++) { for (j = i + 1; j < b + 1; j++) { if (gcd(i, j) == 1) { k += 1; } else continue; } } cout << k << endl; } else { for (i = b; i < a; i++) { for (j = i + 1; j < a + 1; j++) { if (gcd(i, j) == 1) { k += 1; } } } cout << k << endl; } }
标签:class lse name namespace pac else int bsp ++
原文地址:https://www.cnblogs.com/zhanghua-322/p/11302394.html