2015.10.20 福州大学第九届程序设计竞赛
2015-10-22 00:49
274 查看
FZU 2086 餐厅点餐
枚举
练的时候以为是dp---(事实上这场只做了10来分钟---就愉快地滚去吃饭了---)
View Code
FZU 2092 收集水晶
FZU 2093 寻找兔子
枚举
练的时候以为是dp---(事实上这场只做了10来分钟---就愉快地滚去吃饭了---)
#include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #include<set> #include<queue> #include<stack> using namespace std; stack<int> r;//播放记录 int n,m; void solve(){ while(!r.empty()) r.pop(); char op[15]; int x; r.push(1); for(int i = 1;i <= m;i++){ scanf("%s",op); if(op[1] == 'R'){ int y = r.top();r.pop(); // printf("y = %d\n",y); if(r.empty()){ puts("1"); r.push(1); } else{ int z = r.top();r.pop(); printf("%d\n",z); if(!r.empty()) { int zz = r.top(); if(z != zz) r.push(z); } else r.push(z); } } if(op[1] == 'E'){ int y = r.top(); if(y < n){ y++; r.push(y); } printf("%d\n",y); } if(op[1] == 'L'){ scanf("%d",&x); printf("%d\n",x); if(!r.empty()) { int zz = r.top(); if(x != zz) r.push(x); } else r.push(x); } } } int main(){ int T; scanf("%d",&T); while(T--){ scanf("%d %d",&n,&m); solve(); } return 0; }
View Code
FZU 2092 收集水晶
FZU 2093 寻找兔子
相关文章推荐
- kmp和dfa
- 在Asp.net Ajax中使用Session
- Spring实例-通过Java的反射机制和spring IOC初始化JavaBean
- Qt5窗口背景
- Git 执行 「fork 出来的仓库」和「最新版本的原仓库」内容同步更新
- Excel实战之JXL创建
- Leetcode Missing Number
- C语言实现优先级队列——priqueue
- Vim编辑器详解
- SPOJ BALNUM Balanced Numbers (数位dp)
- Hadoop
- String类中Split方法的用法
- Mac下安装 Go
- Reveal 分析App Store 页面布局
- (四)黑马程序员——c语言之学生管理系统程序
- think c++ 笔记
- web页面跳转几种方式详解
- python例子-Django项目中的模版特性
- 亲爱的~help me
- NormalMap 法线贴图