#include<iostream> #include<cstdio> #include<cstring> #include<cmath> using namespace std; int n,m,p,a,b,c,s; int gcd(int x,int y) { if (x>y) swap(x,y); if (!x) return y; return gcd(y%x,x); } int main() { scanf("%d%d%d",&n,&m,&p); s=(m*p)/2; b=p+gcd(n,m); if (n!=p) b+=gcd(abs(n-p),m);else b+=m; printf("%d\n",s+1-b/2); return 0; }
【USACO3-4-2】电网 皮克定理
猜你喜欢
转载自blog.csdn.net/dadatu_zhao/article/details/80443212
今日推荐
周排行