6342.Problem K. Expression in Memories

这个题就是把?变成其他的使得多项式成立并且没有前导零

官方题解:

没意思,好想咸鱼,直接贴一篇别人的博客,写的很好,比我的垃圾好多了。。。

HDU 6342(模拟)

贴一下一个队友的代码:

 //1011-6342-模拟
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<deque>
#include<iomanip>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
using namespace std;
typedef long long ll; const double PI=acos(-1.0);
const double eps=1e-;
const ll mod=1e9+;
const int inf=0x3f3f3f3f;
const int maxn=1e5+;
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); int a[maxn];
char c[maxn]; int main()
{
int t;
scanf("%d",&t);
while(t--){
int flag=;
scanf("%s",c+);
int n=strlen(c+);
for(int i=;i<=n;i++){
if(c[i]>=''&&c[i]<='')
a[i]=;
else if(c[i]=='?')
a[i]=;
else
a[i]=;
if(i!=){
if(a[i]==&&a[i-]==){//++
flag=;
break;
}
}
}
if(c[]==''&&a[]==&&n>){//
if(c[]=='?'){
if(n>&&a[]==)
c[]='+',a[]=;
else
flag=;
}
else
flag=;
}
if(a[n]==||a[]==)//1+ +1
flag=;
for(int i=;i<=n;i++){
if(a[i-]==&&c[i]==''&&a[i+]==&&i>&&i<n){
if(c[i+]!='?'){//
flag=;
break;
}
else if(c[i+]=='?'&&i+>=n){//0?
flag=;
break;
}
}
if(a[i-]==&&c[i]==''&&c[i+]=='?'&&i>&&i+<n){
if(a[i+]==){//0?0
c[i+]='+';
a[i+]=;
}
else{//0?+
flag=;
break;
}
}
}
if(flag)
printf("IMPOSSIBLE\n");
else{
for(int i=;i<=n;i++){
if(c[i]=='?')
c[i]='';
printf("%c",c[i]);
}
cout<<endl;
}
}
}

我发现我的模拟题都写得相当垃圾。。。

垃圾滚了。。。

HDU 6342.Problem K. Expression in Memories-模拟-巴科斯范式填充 (2018 Multi-University Training Contest 4 1011)的更多相关文章

  1. 2018 Multi-University Training Contest 4 Problem K. Expression in Memories 【模拟】

    任意门:http://acm.hdu.edu.cn/showproblem.php?pid=6342 Problem K. Expression in Memories Time Limit: 200 ...

  2. 杭电多校第四场 Problem K. Expression in Memories 思维模拟

    Problem K. Expression in Memories Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262 ...

  3. HDU6342-2018ACM暑假多校联合训练4-1011-Problem K. Expression in Memories

    Problem K. Expression in Memories Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262 ...

  4. @hdu - 6329@ Problem K. Transport Construction

    目录 @description@ @solution@ @accepted code@ @details@ @description@ 给定 n 个点,第 i 个点位于 (xi, yi). 在第 i ...

  5. hdu 3038 How Many Answers Are Wrong(种类并查集)2009 Multi-University Training Contest 13

    了解了种类并查集,同时还知道了一个小技巧,这道题就比较容易了. 其实这是我碰到的第一道种类并查集,实在不会,只好看着别人的代码写.最后半懂不懂的写完了.然后又和别人的代码进行比较,还是不懂,但还是交了 ...

  6. 2015 Multi-University Training Contest 8 hdu 5390 tree

    tree Time Limit: 8000ms Memory Limit: 262144KB This problem will be judged on HDU. Original ID: 5390 ...

  7. 2015 Multi-University Training Contest 7 hdu 5379 Mahjong tree

    Mahjong tree Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Tota ...

  8. Western Subregional of NEERC, Minsk, Wednesday, November 4, 2015 Problem K. UTF-8 Decoder 模拟题

    Problem K. UTF-8 Decoder 题目连接: http://opentrains.snarknews.info/~ejudge/team.cgi?SID=c75360ed7f2c702 ...

  9. 2017 Multi-University Training Contest - Team 9 1004&&HDU 6164 Dying Light【数学+模拟】

    Dying Light Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Tot ...

随机推荐

  1. BZOJ1076 [SCOI2008]奖励关 【状压dp + 数学期望】

    1076: [SCOI2008]奖励关 Time Limit: 10 Sec  Memory Limit: 128 MB Submit: 3074  Solved: 1599 [Submit][Sta ...

  2. 【COGS 14】 [网络流24题] 搭配飞行员 网络流板子题

    用网络流水二分图的模型(存一下板子) #include <cstdio> #include <cstring> #include <algorithm> #defi ...

  3. js生成图片

    var image = new Image(); var c = document.getElementById("myCanvas"); var ctx = c.getConte ...

  4. 洛谷P1522 牛的旅行 Cow Tours

    ---恢复内容开始--- P1522 牛的旅行 Cow Tours189通过502提交题目提供者该用户不存在标签 图论 USACO难度 提高+/省选-提交该题 讨论 题解 记录 最新讨论 输出格式题目 ...

  5. 手动安装GCC

    01sunxiaoqiang的博客 Centos离线手动安装gcc.g++教程 转载 2016-11-06 17:35:18 标签:linux应用笔记 在安装LINUX系统的时候很可能会没有安装gcc ...

  6. MySQL 8.0.11(zip)安装及配置

    (1)下载MySQL8.0.11: (2)解压zip文件: 我解压到了D:/MySQL/mysql-8.0.11-winx64 (3)配置环境变量:   右键此电脑->属性 高级系统设置 环境变 ...

  7. npm安装node-sass失败,EACCES: permission denied

    增加--unsafe-perm,即 sudo npm install node-sass --unsafe-perm --save-dev 成功安装node-sass

  8. js闭包,原型,作用域等再一次理解

    要理解闭包,原型等,首先要理解作用域 作用域:就是函数在定义的时候创建的,用于寻找使用到的变量的值的一个索引,而他内部的规则是,把函数自身的本地变量放在最前面,把自身的父级函数中的变量放在其次,把再高 ...

  9. bzoj3127/3697 [Usaco2013 Open]Yin and Yang

    传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=3127 http://www.lydsy.com/JudgeOnline/problem.ph ...

  10. HDU5772 String problem

    Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission ...