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. poj 1753 Flip Game (dfs)

    Flip Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 28805   Accepted: 12461 Descr ...

  2. BZOJ3223: Tyvj 1729 文艺平衡树 无旋Treap

    一开始光知道pushdown却忘了pushup......... #include<cstdio> #include<iostream> #include<cstring ...

  3. 浅析JavaScript的垃圾回收机制

    JavaScript语言是一门优秀的脚本语言.其中包含脚本语言的灵活性外还拥有许多高级语言的特性.例如充许构建和实例化一个对象,垃圾回收机制(GC:Garbage Collecation).通常我们使 ...

  4. jsonp应用

    1.服务端jsonp格式数据 如客户想访问 : http://www.runoob.com/try/ajax/jsonp.php?jsonp=callbackFunction. 假设客户期望返回JSO ...

  5. codeforces 111D

    题目链接 D. Petya and Coloring time limit per test 5 seconds memory limit per test 256 megabytes input s ...

  6. POJ1182 食物链---(经典种类并查集)

    题目链接:http://poj.org/problem?id=1182   食物链 Time Limit: 1000MS   Memory Limit: 10000K Total Submission ...

  7. python实现多个文件的分发

    之前写的脚本只能分发一个配置,每次分发多个配置总要执行很多次,很不爽,于是就有了这个脚本 from multiprocessing import Process import paramiko imp ...

  8. 【BZOJ】1770 [Usaco2009 Nov]lights 燈

    [算法]高斯消元-异或方程组 [题解]良心简中题意 首先开关顺序没有意义. 然后就是每个点选或不选使得最后得到全部灯开启. 也就是我们需要一种确定的方案,这种方案使每盏灯都是开启的. 异或中1可以完美 ...

  9. openstack中region、az、host aggregate、cell 概念

    1. region 更像是一个地理上的概念,每个region有自己独立的endpoint,regions之间完全隔离,但是多个regions之间共享同一个keystone和dashboard.(注:目 ...

  10. 通过监测DLL调用探测Mimikatz

    通过Sysmon的-l参数可以探测到DLL加载(ImageLoaded): REF: https://securityriskadvisors.com/blog/post/detecting-in-m ...