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

歡迎訪問 生活随笔!

生活随笔

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

编程问答

uva 1605 ——Building for UN

發布時間:2023/11/30 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 uva 1605 ——Building for UN 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

題意:給定n,讓設計一個大樓,使得n個國家任意兩個國家都相鄰或上下層。

?

思路:由于題目中的限定很小,可以這樣考慮,只設計兩層,每層的第i行為同一個國家,第二層的所有第j列為同一個國家,這樣就滿足了條件。

?

Code:

?

#include <iostream> #include <cstdio> #include <cmath> #include <algorithm> #include <cstring> #include <sstream> #include <string> #include <vector> #include <list> #include <queue> #include <stack> #include <map> #include <set> #include <bitset>using namespace std;typedef long long ll; typedef unsigned long long ull; typedef long double ld;const int INF=0x3fffffff; const int inf=-INF; const int N=1000000; const int M=2005; const int mod=1000000007; const double pi=acos(-1.0);#define cls(x,c) memset(x,c,sizeof(x)) #define cpy(x,a) memcpy(x,a,sizeof(a)) #define fr(i,s,n) for (int i=s;i<=n;i++) #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 #define lrt rt<<1 #define rrt rt<<1|1 #define middle int m=(r+l)>>1 #define lowbit(x) (x&-x) #define pii pair<int,int> #define mk make_pair #define IN freopen("in.txt","r",stdin); #define OUT freopen("out.txt","w",stdout);char f[52]; int main() {int n,len=0;fr(i,0,25) f[len++]='A'+i;fr(i,0,25) f[len++]='a'+i;while (~scanf("%d",&n)&&n){printf("2 %d %d\n",n,n);fr(i,0,n-1) {fr(j,1,n) printf("%c",f[i]);puts("");}puts("");fr(i,0,n-1) {fr(j,0,n-1) printf("%c",f[j]);puts("");}puts("");} }

總結

以上是生活随笔為你收集整理的uva 1605 ——Building for UN的全部內容,希望文章能夠幫你解決所遇到的問題。

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