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

歡迎訪問 生活随笔!

生活随笔

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

编程问答

hdu 4350 2012 多校 - 6

發(fā)布時(shí)間:2025/3/20 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 hdu 4350 2012 多校 - 6 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

題意:一個(gè)長度為52的數(shù)組每次從中去[l,r]放到最前面,操作k次問你數(shù)組是什么樣的。

思路:由于k很大當(dāng)時(shí)就想肯定要摸一個(gè)數(shù),然后用樣例打了個(gè)表發(fā)現(xiàn)只要模r就行了。是一道水題

代碼如下:

1 /************************************************** 2 * Author : xiaohao Z 3 * Blog : http://www.cnblogs.com/shu-xiaohao/ 4 * Last modified : 2014-05-11 16:32 5 * Filename : A.cpp 6 * Description : 7 * ************************************************/ 8 9 #include <iostream> 10 #include <cstdio> 11 #include <cstring> 12 #include <cstdlib> 13 #include <cmath> 14 #include <algorithm> 15 #include <queue> 16 #include <stack> 17 #include <vector> 18 #include <set> 19 #include <map> 20 #define MP(a, b) make_pair(a, b) 21 #define PB(a) push_back(a) 22 23 using namespace std; 24 typedef long long ll; 25 typedef pair<int, int> pii; 26 typedef pair<unsigned int,unsigned int> puu; 27 typedef pair<int, double> pid; 28 typedef pair<ll, int> pli; 29 typedef pair<int, ll> pil; 30 31 const int INF = 0x3f3f3f3f; 32 const double eps = 1E-6; 33 const int LEN = 100; 34 vector<int> cd, tcd; 35 36 int main() 37 { 38 // freopen("in.txt", "r", stdin); 39 40 int t, n, l, r, tmp, kase = 1; 41 cin >> t; 42 while(t--){ 43 cd.clear(); 44 tcd.clear(); 45 for(int i=0; i<52; i++){ 46 cin >> tmp; 47 cd.PB(tmp); 48 } 49 cin >> n >> l >> r; 50 r--, l--; 51 n %= r+1; 52 for(int i=0; i<n; i++){ 53 stack<int> q; 54 for(int j=l; j<=r; j++) q.push(cd[j]); 55 for(int j=l; j<=r; j++) cd.erase(cd.begin()+l); 56 while(!q.empty()){ 57 cd.insert(cd.begin(), q.top()); 58 q.pop(); 59 } 60 } 61 printf("Case #%d: ", kase ++); 62 for(int i=0; i<52; i++){ 63 printf("%d", cd[i]); 64 if(i != 51) printf(" "); 65 else printf("\n"); 66 } 67 } 68 return 0; 69 } View Code

?

轉(zhuǎn)載于:https://www.cnblogs.com/shu-xiaohao/p/3722481.html

總結(jié)

以上是生活随笔為你收集整理的hdu 4350 2012 多校 - 6的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

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