日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

高速公路 (Highway,CERC 2006,LA 3720)

發布時間:2024/4/17 编程问答 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 高速公路 (Highway,CERC 2006,LA 3720) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

感謝 http://www.cnblogs.com/zhexipinnong/archive/2013/05/07/3064893.html

1 #include <iostream> 2 #include <string.h> 3 #include <string> 4 #include <fstream> 5 #include <algorithm> 6 #include <stdio.h> 7 #include <vector> 8 #include <queue> 9 #include <set> 10 #include <cmath> 11 using namespace std; 12 const double eps = 1e-8; 13 const int INF=0x7fffffff; 14 unsigned long long uINF = ~0LL; 15 #define MAXN 10000007 16 typedef long long LL; 17 LL gcd(LL a,LL b) 18 { 19 return b==0?a:gcd(b,a%b); 20 } 21 int g[301][301]; 22 void init() 23 { 24 for(int i=1;i<=300;i++) 25 for(int j=1;j<=300;j++) 26 g[i][j]=gcd(i,j); 27 } 28 int main() 29 { 30 int n,m; 31 init(); 32 while(scanf("%d%d",&n,&m),n+m!=0) 33 { 34 LL ans=0; 35 n--;m--; 36 if(n>m)swap(n,m); 37 38 for(int i=1;i<=n;i++) 39 for(int j=i;j<=m;j++) 40 if(g[i][j]<=2) 41 { 42 LL temp=(n-i+1)*(m-j+1); 43 if(i==j) 44 { 45 if(g[i][j]==1)ans+=temp; 46 else ans-=temp; 47 } 48 else 49 { 50 if(i<=m&&j<=n)temp+=(m-i+1)*(n-j+1); 51 if(g[i][j]==1)ans+=temp; 52 else ans-=temp; 53 } 54 } 55 ans*=2; 56 printf("%lld\n",ans); 57 } 58 59 return 0; 60 }

?

轉載于:https://www.cnblogs.com/TO-Asia/p/3210814.html

總結

以上是生活随笔為你收集整理的高速公路 (Highway,CERC 2006,LA 3720)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。