博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[NOIP2017]时间复杂度(模拟)
阅读量:4453 次
发布时间:2019-06-07

本文共 1172 字,大约阅读时间需要 3 分钟。

sscanf读入数字,getline(cin,string)读一整行,其余暴力模拟即可。

1 #include
2 #include
3 #include
4 #include
5 #include
6 #define rep(i,l,r) for (int i=(l); i<=(r); i++) 7 typedef long long ll; 8 using namespace std; 9 10 const int N=110;11 int T,n,w[N];12 char p[N],s[N];13 string str;14 15 int main(){16 freopen("comp.in","r",stdin);17 freopen("comp.out","w",stdout);18 for (scanf("%d",&T); T--; ){19 scanf("%d%s",&n,p); int d,ans=0,top=0; bool flag=0;20 if (p[2]=='1') d=0; else sscanf(p+4,"%d",&d);21 rep(i,1,n){22 if (flag) { getline(cin,str); continue; }23 scanf("%s",p);24 if (p[0]=='F'){25 scanf("%s",p); s[++top]=p[0]; int x=0,a,b;26 scanf("%s",p); if (p[0]=='n') a=101; else sscanf(p,"%d",&a);27 scanf("%s",p); if (p[0]=='n') b=101; else sscanf(p,"%d",&b);28 if (a>b) w[top]=0;29 else if (a
0; puts(flag?"ERR":ans==d?"Yes":"No");40 }41 return 0;42 }

 

转载于:https://www.cnblogs.com/HocRiser/p/9840795.html

你可能感兴趣的文章
IIS下配置跨域设置Access-Control-Allow-Origin
查看>>
JS金字塔
查看>>
Ajax与JSON的一些总结
查看>>
C#常用控件属性及方法介绍
查看>>
51单片机寻址方式
查看>>
DB太大?一键帮你收缩所有DB文件大小(Shrink Files for All Databases in SQL Server)
查看>>
二叉树
查看>>
Leetcode: Convert Sorted Array to Binary Search Tree
查看>>
#python#类和实例绑定属性和方法的总结
查看>>
C#委托事件的理解猫与老鼠的故事
查看>>
TS4
查看>>
tomcat server.xml配置详解
查看>>
java05
查看>>
前后端通信 (3种方式简单介绍)
查看>>
java条件语句练习题
查看>>
文件操作open,r,w,a三种模式
查看>>
开发工具安装密钥
查看>>
十一周总结学习笔记
查看>>
dubbo控制器xml文件报错
查看>>
extjs 控件属性
查看>>