歡迎您來到Tanky Woo的博客:
我們的【C++奮斗樂園】
C++/算法網(wǎng)站:www.cpply.com
C++/算法論壇:www.cppleyuan.com
QQ群:①群:19333724 ②群:23840480 ③群:17314377 ④群:23829384
比較經(jīng)典的模擬題,注意對(duì)細(xì)節(jié)的考慮,以及對(duì)過程的模擬。
內(nèi)存: 1848kB
時(shí)間: 16ms
語言: C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Grid 2746 Joseph
// Author: Tanky Woo
#include <iostream>
#define MAX 301
int aLoop[MAX];
// www.wutianqi.com
int main()
{
int n, m;
int i;
while(scanf("%d %d", &n, &m) && n && m)
{
for(i = 0; i < n; i++)
aLoop[i] = i+1;
int nPtr = 0;
for(i = 0; i < n; i++)
{
int nCnt = 0;
while(nCnt < m)
{
while(aLoop[nPtr] == 0)
nPtr = [...]
文章來源:
http://www.wutianqi.com/?p=292
posted on 2010-07-09 17:03
Tanky Woo 閱讀(174)
評(píng)論(0) 編輯 收藏 引用