摘要:
//Time 0ms, Memory 280K#include
using namespace std;
int main()
{ int n,t; while(cin>>n) { t=18; while(t=n) cout<<"Stan wins."<<endl; else cout<<"Ollie wins."<<endl; } return 0;
} 阅读全文
摘要:
//Time 187ms, Memory 808K#include
#include
#include
using namespace std;
int s[101],h,ans[101],k,m,sg[10010];
int mex(int x)
{ if(sg[x]!=-1) return sg[x]; int i,v[101]; memset(v,0,sizeof(v)); for(i=0;i>k && k) { for(int i=0;i>s[i]; } sort(s,s+k); m... 阅读全文
摘要:
阅读本篇之前推荐阅读以下姊妹篇:《秒杀多线程第四篇一个经典的多线程同步问题》《秒杀多线程第五篇经典线程同步关键段CS》《秒杀多线程第六篇经典线程同步事件Event》《秒杀多线程第七篇经典线程同步互斥量Mutex》《秒杀多线程第八篇经典线程同步信号量Semaphore》《秒杀多线程第九篇经典线程同步总结关键段事件互斥量信号量》《秒杀多线程第十篇生产者消费者问题》《秒杀多线程第十一篇读者写者问题》上面的文章讲解了在Windows系统下实现多线程同步互斥的方法,为了提高在实际问题中分析和思考多个线程之间同步互斥问题的能力,接下来将讲解PV操作,这也是操作系统中的重点和难点。本文将会先简要介绍下PV操 阅读全文
摘要:
//Time 15ms, Memory 292K#include
using namespace std;
int main()
{ int n,a[101],t; while(cin>>n && n) { t=0; for(int i=0;i>a[i]; t^=a[i]; } if(t) { int cnt=0; for(int i=0;i=0) cnt++;//注意,大于号的优先级要高于异或运算! ... 阅读全文
摘要:
这是一道简单的博弈题。刚开始我用建表的方法来做,代码如下://Time 31ms, Memory 15920K
#include
#include
using namespace std;
int a[2001][2001];
int main()
{ int i,j,n,m,t; memset(a,0,sizeof(a)); for(i=0;i>n>>m && (n || m)) { if(a[n-1][m-1]) cout
int main()
{ int n,m; while(scanf("%d%d",&n,&m)== 阅读全文