生活随笔
收集整理的這篇文章主要介紹了
                                
【PAT乙级】1069 微博转发抽奖 (20 分)
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.                        
 
                                
                            
                            
                            
 題目地址
 
#include<cstdio>
#include<iostream>
#include<string>
#include<map>
#include<vector>
using namespace std
;
string ss
[1005];
map
<string
,int>mp
;
vector
<string
>ve
;
int main(void)
{int m
,n
,s
; cin
>>m
>>n
>>s
;for(int i
=1;i
<=m
;i
++) cin
>>ss
[i
];if(n
+s
>m
) cout
<<"Keep going..."<<endl
;else{for(int i
=s
;i
<=m
;) {if(!mp
[ss
[i
]]) ve
.push_back(ss
[i
]),mp
[ss
[i
]]=1,i
+=n
;else i
++;}}for(auto t
: ve
) cout
<<t
<<endl
;return 0;
}
 
#include<cstdio>
#include<iostream>
#include<map>
using namespace std
;
map
<string
,int>mp
;
string s
[1005];
int n
,st
,k
;
int main(void)
{cin
>>n
>>k
>>st
;for(int i
=1;i
<n
;i
++) cin
>>s
[i
];if(st
>n
) cout
<<"Keep going..."<<endl
;else{for(int i
=st
;i
<=n
;){if(!mp
[s
[i
]]) cout
<<s
[i
]<<endl
,i
=i
+k
,mp
[s
[i
]]++;else i
++;}}
}
                            總結(jié)
                            
                                以上是生活随笔為你收集整理的【PAT乙级】1069 微博转发抽奖 (20 分)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
                            
                            
                                如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。