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. NOIP临考经验【转】

    NOIP临考经验 1.提前15分钟入场,此时静坐调整心态,适当的深呼吸 2.打开编辑器并调整为自己喜欢的界面 3.熟悉文件目录,写好准确无误的代码模板 4.压缩包或许还不能解压,但是文件名已经可以知道 ...

  2. [洛谷P1231] 教辅的组成

    题目大意:有n1本书,n2本练习册和n3个答案,然后又一些条件,说明某本答案可能和某本书对应,某本练习册可能和某本书对应,求最多有多少本完整的书(有书,练习册,答案) 题解:网络流,对应就连边,然后考 ...

  3. [Leetcode] Anagrams 颠倒字母构成词

    Given an array of strings, return all groups of strings that are anagrams. Note: All inputs will be ...

  4. [Leetcode] Add two numbers 两数之和

    You are given two linked lists representing two non-negative numbers. The digits are stored in rever ...

  5. Jsp上传组件Smartupload介绍

    <form action="UploadServlet" enctype="multipart/form-data" method="post& ...

  6. Fabric证书解析

    一.证书目录解析   通过cryptogen生成所有证书文件后,以peerOrgannizations的第一个组织树org1为例,每个目录和对应文件的功能如下:   ca: 存放组织的根证书和对应的私 ...

  7. Educational Codeforces Round 56 (Rated for Div. 2) ABCD

    题目链接:https://codeforces.com/contest/1093 A. Dice Rolling 题意: 有一个号数为2-7的骰子,现在有一个人他想扔到几就能扔到几,现在问需要扔多少次 ...

  8. 浏览器 连不上网 (3):DNS 服务器问题

    解决:设置一下DNS服务器的地址 步骤: 打开网络和共享中心(网络和 Internet设置)-> 更改适配器 -> 双击我们连接的 无线网(WiFi式) 或 以太网(网线式): 从出现的窗 ...

  9. Spring 学习笔记(二)

      一.Spring 中的bean配置 –配置形式:基于 XML 文件的方式:基于注解的方式 –Bean 的配置方式:通过全类名(反射).通过工厂方法(静态工厂方法 & 实例工厂方法).Fac ...

  10. node导入导出的问题

    node的每一个文件,都是一个域,那么里面所有的变量都不允许被外界引用,除非导出去.要使用外界的变量,也必须使用导入的方式导入进来. import 变量名 from '文件地址'//css可以直接导入 ...