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

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

模拟 Codeforces Round #249 (Div. 2) C. Cardiogram

發(fā)布時(shí)間:2025/5/22 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 模拟 Codeforces Round #249 (Div. 2) C. Cardiogram 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

?

題目地址:http://codeforces.com/contest/435/problem/C

1 /* 2 題意:給一組公式,一組數(shù)據(jù),計(jì)算得到一系列的坐標(biāo)點(diǎn),畫出折線圖:) 3 模擬題:蠻惡心的,不過也簡(jiǎn)單,依據(jù)公式得知折線一定是一上一下的,只要把兩個(gè)相鄰的坐標(biāo)之間的折線填充就好 4 注意:坐標(biāo)有可能為負(fù)數(shù),所以移動(dòng)值y初始化為1000,最后要倒過來輸出 5 詳細(xì)解釋:http://blog.csdn.net/zhb1997/article/details/27877783 6 */ 7 #include <cstdio> 8 #include <iostream> 9 #include <algorithm> 10 #include <cstring> 11 #include <string> 12 #include <cmath> 13 #include <set> 14 using namespace std; 15 16 const int MAXN = 1e3 + 10; 17 const int INF = 0x3f3f3f3f; 18 int map[MAXN<<1][MAXN<<1]; 19 int a[MAXN]; 20 21 int main(void) //Codeforces Round #249 (Div. 2) C. Cardiogram 22 { 23 //freopen ("G.in", "r", stdin); 24 25 int n; 26 while (~scanf ("%d", &n)) 27 { 28 int tot = 0; int mx = 1000, mn = 1000, x = 0, y = 1000; 29 for (int i=1; i<=n; ++i) scanf ("%d", &a[i]), tot += a[i]; 30 31 memset (map, 0, sizeof (map)); 32 for (int i=1; i<=n; ++i) 33 { 34 x++; 35 if (i & 1) //奇數(shù)一定'/' 36 { 37 a[i]--; 38 map[y][x] = 1; 39 while (a[i]--) 40 { 41 x++; y++; 42 map[y][x] = 1; 43 } 44 mx = max (mx, y); 45 } 46 else //偶數(shù)一定'\' 47 { 48 a[i]--; 49 map[y][x] = 2; 50 while (a[i]--) 51 { 52 x++; y--; 53 map[y][x] = 2; 54 } 55 mn = min (mn, y); 56 } 57 } 58 59 //printf ("%d %d\n", mx, mn); 60 for (int i=mx; i>=mn; --i) //y坐標(biāo) 61 { 62 for (int j=1; j<=tot; ++j) //x坐標(biāo) 63 { 64 if (map[i][j] == 1) printf ("/"); 65 else if (map[i][j] == 2) printf ("\\"); 66 else printf (" "); 67 } 68 puts (""); 69 } 70 } 71 72 return 0; 73 }

?

轉(zhuǎn)載于:https://www.cnblogs.com/Running-Time/p/4385027.html

總結(jié)

以上是生活随笔為你收集整理的模拟 Codeforces Round #249 (Div. 2) C. Cardiogram的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。