锘??xml version="1.0" encoding="utf-8" standalone="yes"?>欧美日韩三级视频,性色一区二区,亚洲欧洲日产国码二区http://m.shnenglu.com/goAheadtw/category/15892.htmlhahazh-cnWed, 19 Jan 2011 03:26:21 GMTWed, 19 Jan 2011 03:26:21 GMT60Timus 1087(recursion game)http://m.shnenglu.com/goAheadtw/articles/138752.htmltwtwTue, 18 Jan 2011 07:23:00 GMThttp://m.shnenglu.com/goAheadtw/articles/138752.htmlhttp://m.shnenglu.com/goAheadtw/comments/138752.htmlhttp://m.shnenglu.com/goAheadtw/articles/138752.html#Feedback0http://m.shnenglu.com/goAheadtw/comments/commentRss/138752.htmlhttp://m.shnenglu.com/goAheadtw/services/trackbacks/138752.html1087. The Time to Take Stones
Time Limit: 1.0 second
Memory Limit: 16 MB
You probably know the game where two players in turns take 1 to 3 stones from a pile. Looses the one who takes the last stone. We'll generalize this well known game. Assume that both of the players can take not 1, 2 or 3 stones, but k1, k2, …, km ones. Again we'll be interested in one question: who wins in the perfect game. It is guaranteed that it is possible to make next move irrespective to already made moves.

Input

The first line contains two integers: n and m (1 ≤ n ≤ 10000; 1 ≤ m ≤ 50) 鈥?they are an initial amount of stones in the pile and an amount of numbers k1, …, km. The second line consists of the numbers k1, …, km, separated with a space (1 ≤ kin).

Output

Output 1, if the first player (the first to take stones) wins in a perfect game. Otherwise, output 2.

Sample

input output
17 3
            1 3 4
            
2
            
Problem Author: Anton Botov
Problem Source: The 3rd high school children programming contest, USU, Yekaterinburg, Russia, March 4, 2001



/*
"Looses the one who takes the last stone" 鈥斺?nbsp;the one takes the last 
stone loses the game ! 
*/ 
#include 
<stdio.h>
#include 
<memory>
#include 
<iostream>
#include 
<algorithm>
#include 
<cstring>
#include 
<vector>
#include 
<map>
#include 
<cmath>
#include 
<set>
#include 
<queue>
#include 
<time.h> 
#include 
<limits>
using namespace std; 
#define N 10005
#define M 55
int step[M], n, m; 
bool state[N]; 
bool input(){
    
if(scanf("%d%d"&n, &m) == EOF) return false
    
int i; 
    
for(i = 0; i < m; i++) scanf("%d", step+i);
    
return true
}
void solve(){
    memset(state, 
0sizeof(bool* (n+1)); 
    
int i, j, u; 
    
for(i = 1; i <= n; i++){
        
for(j = 0; j < m; j++){
            
if((u = i - step[j]) >= 0){
                
if(u == 0){
                    state[i] 
= false
                }
else{
                    
if(!state[u]){
                        state[i] 
= true
                        
break
                    }
                }
            }
        }
    }
    
//for(i = 0; i <= n; i++) printf("s[%d]=%d\n", i, state[i]);
    if(state[n]) printf("1\n");
    
else printf("2\n");
}
int main(){
#ifndef ONLINE_JUDGE
    freopen(
"in.txt""r", stdin); 
    
//freopen("out.txt", "w", stdout); 
#endif 
    
while(input()) solve(); 
    
return 0;
}



tw 2011-01-18 15:23 鍙戣〃璇勮
]]>
Timus 1045 (game on a tree)http://m.shnenglu.com/goAheadtw/articles/138667.htmltwtwMon, 17 Jan 2011 06:13:00 GMThttp://m.shnenglu.com/goAheadtw/articles/138667.htmlhttp://m.shnenglu.com/goAheadtw/comments/138667.htmlhttp://m.shnenglu.com/goAheadtw/articles/138667.html#Feedback0http://m.shnenglu.com/goAheadtw/comments/commentRss/138667.htmlhttp://m.shnenglu.com/goAheadtw/services/trackbacks/138667.html 

#include <stdio.h>
#include 
<memory>
#include 
<iostream>
#include 
<algorithm>
#include 
<cstring>
#include 
<vector>
#include 
<map>
#include 
<cmath>
#include 
<set>
#include 
<queue>
#include 
<time.h> 
#include 
<limits>
using namespace std; 
#define N 1005
struct e{
    
int v; 
    e
* nxt; 
}es[N
*2];
e
* fir[N]; 
int en, n, st, l; 
bool state[N]; 
inline 
void add_e(int u, int v){
    es[en].v 
= v; es[en].nxt = fir[u]; fir[u] = &es[en++]; 
}
bool input(){
    
if(scanf("%d%d"&n, &st) == EOF) return false
    st
--
    
int i, u, v; 
    
for(i = 0; i < n; i++) fir[i] = NULL; 
    en 
= 0
    
for(i = 1; i < n; i++){
        scanf(
"%d%d"&u, &v);
        u
--
        v
--
        add_e(u, v);
        add_e(v, u); 
    }
    
return true
}
void dfs(int u, int fa){
    e
* cur; 
    
int v; 
    
bool hasSon = false
    
for(cur = fir[u]; cur; cur = cur->nxt){
        
if((v = cur->v) != fa){
            hasSon 
= true
            dfs(v, u); 
        }
    }
    
if(!hasSon){
        state[u] 
= false;   //蹇呰觸鎬?/span>
    }else{
        state[u] 
= false
        
for(cur = fir[u]; cur; cur = cur->nxt){
            
if((v = cur->v) != fa){
                
if(!state[v]){
                    
if(u == st){
                        
if(state[u]){
                            
if(l > v + 1) l = v + 1
                        }
else{
                            state[u] 
= true
                            l 
= v + 1
                        }
                    }
else state[u] = true
                }
            }
        }
    }
}
void solve(){
    dfs(st, 
-1); 
    
if(state[st]) printf("First player wins flying to airport %d\n", l);
    
else printf("First player loses\n");
}
int main(){
#ifndef ONLINE_JUDGE
    freopen(
"in.txt""r", stdin); 
    
//freopen("out.txt", "w", stdout); 
#endif 
    
while(input()) solve(); 
    
return 0;
}





tw 2011-01-17 14:13 鍙戣〃璇勮
]]>
Timus 1023(Bash Game)http://m.shnenglu.com/goAheadtw/articles/138665.htmltwtwMon, 17 Jan 2011 05:24:00 GMThttp://m.shnenglu.com/goAheadtw/articles/138665.htmlhttp://m.shnenglu.com/goAheadtw/comments/138665.htmlhttp://m.shnenglu.com/goAheadtw/articles/138665.html#Feedback0http://m.shnenglu.com/goAheadtw/comments/commentRss/138665.htmlhttp://m.shnenglu.com/goAheadtw/services/trackbacks/138665.html// bash game
#include <stdio.h>
#include <memory>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <cmath>
#include <set>
#include <queue>
#include <time.h>
#include <limits>
using namespace std;
int cal(int a){
 int b, ans;
 ans = inf;
 for(b = 1; b * b <= a; b++){
  if(!(a % b)){
   if(b > 2 && b < ans) ans = b;
   if((a / b) > 2 && (a / b) < ans) ans = (a / b);
  }
 }
 if(ans < inf) return ans - 1;
 else return a - 1;
}
int main(){
#ifndef ONLINE_JUDGE
 //freopen("in.txt", "r", stdin);
 //freopen("out.txt", "w", stdout);
#endif
 init();
 int a;
 while(~scanf("%d", &a)){
  printf("%d\n", cal(a));
 }
 return 0;
}

 

 



tw 2011-01-17 13:24 鍙戣〃璇勮
]]>
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            在线欧美电影| 蜜月aⅴ免费一区二区三区| 久久综合久久综合久久| 欧美在线在线| 久久九九久精品国产免费直播| 欧美在线免费观看视频| 久久久久网站| 欧美激情免费在线| 亚洲精品在线免费| 亚洲一级在线| 久久精品视频免费| 欧美高清在线视频观看不卡| 欧美日韩精品二区第二页| 国产精品三上| 亚洲国产欧美不卡在线观看| 在线天堂一区av电影| 欧美在线播放一区二区| 欧美jjzz| 亚洲影音一区| 欧美成人免费播放| 国产精品伦子伦免费视频| 亚洲高清三级视频| 亚洲欧美日韩一区| 欧美黑人一区二区三区| 亚洲欧美综合一区| 欧美精选在线| 一区二区三区在线视频免费观看 | 亚洲免费不卡| 先锋影音久久久| 欧美伦理91| 樱桃成人精品视频在线播放| 久久精品首页| 日韩视频在线观看国产| 欧美中文在线观看国产| 欧美日韩一区在线视频| 最新国产成人av网站网址麻豆| 性色av一区二区三区红粉影视| 亚洲国产精品精华液2区45| 亚洲欧美日韩另类| 国产精品久久久久久久9999| 最新国产成人在线观看| 久久久精品久久久久| 一区二区免费在线视频| 欧美成人四级电影| 在线看国产一区| 久久精选视频| 亚洲欧美在线一区| 国产精品久久久久久久浪潮网站| 亚洲美女在线视频| 亚洲第一区在线观看| 久久久久久久综合日本| 国产在线观看精品一区二区三区| 亚洲一区二区三区中文字幕在线| 亚洲精品久久久蜜桃| 欧美护士18xxxxhd| 亚洲美女精品久久| 亚洲国产高潮在线观看| 免费日韩av电影| 亚洲高清视频一区二区| 欧美 日韩 国产 一区| 久久亚洲精品伦理| 1769国内精品视频在线播放| 老司机一区二区三区| 久久久之久亚州精品露出| 在线观看日韩| 亚洲第一精品在线| 欧美另类亚洲| 亚洲欧美另类在线| 亚洲女同精品视频| 国产日韩欧美另类| 久久青青草综合| 美女精品在线观看| 一区二区免费在线播放| 在线亚洲免费| 国产揄拍国内精品对白| 欧美成人午夜激情在线| 欧美精品电影在线| 亚洲欧美日韩另类精品一区二区三区| 亚洲免费影视| 亚洲第一精品电影| 亚洲精品视频在线| 国产精品一区二区黑丝| 久热精品视频在线免费观看 | 一区二区三区四区国产精品| 国产精品久久| 男女av一区三区二区色多| 欧美精品www| 欧美一级在线视频| 久久久精品视频成人| a4yy欧美一区二区三区| 麻豆精品91| av成人老司机| 国产日韩在线视频| 亚洲第一网站免费视频| 国产精品成人aaaaa网站| 久久精品91久久久久久再现| 美女性感视频久久久| 亚洲自拍另类| 欧美a级一区二区| 新狼窝色av性久久久久久| 久久综合国产精品台湾中文娱乐网| 99综合在线| 久久久久网址| 亚洲欧美一区二区原创| 亚洲欧美激情四射在线日| 欧美在线亚洲| 亚洲深夜激情| 久久中文久久字幕| 欧美一区亚洲二区| 欧美日韩另类字幕中文| 免费短视频成人日韩| 国产精品久99| 亚洲美女91| 亚洲人成高清| 久久久噜噜噜久久人人看| 欧美一级专区免费大片| 欧美日韩免费| 亚洲黑丝一区二区| 亚洲国产合集| 久久亚洲一区二区三区四区| 欧美一区中文字幕| 国产精品久久国产精品99gif | 午夜宅男久久久| 欧美区一区二区三区| 欧美国产日韩a欧美在线观看| 国色天香一区二区| 欧美一区二区三区免费观看| 亚洲专区在线视频| 欧美午夜精品久久久久久浪潮 | 亚洲电影免费观看高清完整版在线 | 99视频在线观看一区三区| 久久视频一区| 玖玖在线精品| 狠狠综合久久av一区二区老牛| 香蕉尹人综合在线观看| 久久激情中文| 国产亚洲精品高潮| 欧美一区日韩一区| 久久亚裔精品欧美| 在线精品国产欧美| 浪潮色综合久久天堂| 亚洲国产高清一区二区三区| 亚洲久久视频| 欧美午夜激情视频| 性欧美xxxx大乳国产app| 欧美日韩一区二区精品| 久久国产婷婷国产香蕉| 国产区欧美区日韩区| 亚洲欧美日产图| 久久久久91| 亚洲日本va在线观看| 欧美日韩福利在线观看| 亚洲一区区二区| 久久嫩草精品久久久久| 亚洲精品久久久久| 国产精品国产亚洲精品看不卡15 | 久久精品噜噜噜成人av农村| 国产在线欧美日韩| 老鸭窝毛片一区二区三区| 亚洲欧洲另类| 午夜精品视频| 亚洲国产99| 欧美午夜精品久久久久久人妖 | 国产精品三级视频| 久久九九国产| 日韩视频在线观看| 久久女同精品一区二区| 日韩视频免费观看| 国产欧美一区二区三区久久| 欧美成人午夜激情| 香港久久久电影| 亚洲国产欧美在线| 欧美一区日韩一区| 日韩亚洲精品视频| 国产一区二区三区精品欧美日韩一区二区三区 | 欧美一级成年大片在线观看| 亚洲国产精品久久久久婷婷老年| 欧美日韩一区三区四区| 久久中文精品| 午夜视频一区| 一区二区三区日韩精品视频| 欧美黑人多人双交| 久久久久久久尹人综合网亚洲| 在线一区二区视频| 亚洲国产精品一区二区www| 国产噜噜噜噜噜久久久久久久久| 欧美a级理论片| 久久久欧美精品sm网站| 亚洲免费在线视频一区 二区| 亚洲国内高清视频| 免费成人av在线看| 日韩视频免费| 午夜精品久久99蜜桃的功能介绍| 狠狠做深爱婷婷久久综合一区| 欧美日韩精品一区二区在线播放| 久久精品在线播放| 亚洲欧美精品一区| 99国产精品久久久久久久成人热| 免费亚洲视频| 久久影视三级福利片|