1.小中大(100分)

#include<iostream>
#include<cstdio>
#define maxn 100010
using namespace std;
int a[maxn],n;
int main(){
scanf("%d",&n);
for(int i=;i<=n;i++)scanf("%d",&a[i]);
int x,z;
double y;
x=a[];z=a[n];
if(x<z)swap(x,z);
printf("%d ",x);
if(n%==){
y=(double)(a[n/]+a[n/+])/2.0;
}
else {
y=a[n/+];
}
if(y==(int)y)printf("%.0f ",y);
else printf("%.1f ",y);
printf("%d\n",z);
return ; }

2.二十四点(100分)

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int n,st[],top;
char s[];
int main(){
freopen("Cola.txt","r",stdin);
scanf("%d",&n);
while(n--){
top=;
scanf("%s",s+);
int pre=;
for(int i=;i<=;i++){
if(s[i]<=''&&s[i]>=''){
int a=s[i]-'';
st[++top]=pre*a;
}
else{
if(s[i]=='+')pre=;
else if(s[i]=='-')pre=-;
else if(s[i]=='x'){
int b=s[i+]-'';
int a=st[top];
st[top]=a*b;
i++;
}
else{
int b=s[i+]-'';
int a=st[top];
st[top]=a/b;
i++;
}
}
}
int ans=;
for(int i=;i<=top;i++)ans+=st[i];
// printf("%d\n",ans);
if(ans==){puts("Yes");}
else {puts("No");}
}
return ;
}

csp模拟题-201903的更多相关文章

  1. CSP复赛day2模拟题

    没错,我又爆零了.....先让我自闭一分钟.....so 当你忘记努力的时候,现实会用一记响亮的耳光告诉你东西南北在哪. 好了,现在重归正题: 全国信息学奥林匹克联赛(NOIP2014) 复赛模拟题 ...

  2. csp模拟赛低级错误及反思

    \(csp\)模拟赛低级错误及反思. 1.没开\(longlong\). 反思:注意数据类型以及数据范围. 2.数组越界(前向星数组未开两倍,一题的数据范围应用到另一题上,要开两倍的写法为开两倍数组) ...

  3. poj 1008:Maya Calendar(模拟题,玛雅日历转换)

    Maya Calendar Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 64795   Accepted: 19978 D ...

  4. poj 1888 Crossword Answers 模拟题

    Crossword Answers Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 869   Accepted: 405 D ...

  5. CodeForces - 427B (模拟题)

    Prison Transfer Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Sub ...

  6. sdut 2162:The Android University ACM Team Selection Contest(第二届山东省省赛原题,模拟题)

    The Android University ACM Team Selection Contest Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里 ...

  7. 全国信息学奥林匹克联赛 ( NOIP2014) 复赛 模拟题 Day1 长乐一中

    题目名称 正确答案  序列问题 长途旅行 英文名称 answer sequence travel 输入文件名 answer.in sequence.in travel.in 输出文件名 answer. ...

  8. UVALive 4222 Dance 模拟题

    Dance 题目连接: https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&pag ...

  9. cdoj 25 点球大战(penalty) 模拟题

    点球大战(penalty) Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/show/2 ...

随机推荐

  1. 解决 eclipse出现 Address already in use: bind,以及tomcat端口占用

    在项目开发中,有时候我们发现回报这个错:解决 eclipse出现 Address already in use: bind 产生的原因是端口占用,比如你的8080端口,已经有一个进程在访问使用,但是你 ...

  2. cartographer 3D scan matching 理解

    cartographer 3D scan matching没有论文和其它资料,因此尝试通过源码理解其处理方法,理解不当之处还请指正. 目录: 0.2D 匹配方法简介 1.real time corre ...

  3. 服务器jvm参数配置

    Eclipse崩溃,错误提示: MyEclipse has detected that less than 5% of the 64MB of Perm Gen (Non-heap memory) s ...

  4. 【STM32H7教程】第31章 STM32H7的USART应用之RS485

    完整教程下载地址:http://www.armbbs.cn/forum.php?mod=viewthread&tid=86980 第31章       STM32H7的USART应用之RS48 ...

  5. 0x00007FFC8C5325E7 (ucrtbased.dll)处(位于 DataStructure.exe 中)引发的异常: 0xC0000005: 读取位置 0xFFFFFFFFFFFFFFFF 时发生访问冲突。

    此处为非“%s” 类型数据以“%s”类型打印错误. 需要仔细检查代码中数据类型错误.

  6. 正则表达式中的.*?和python中re.S参数的详解

    本章的内容主要是为讲解在正则表达式中常用的.*?和re.S! 在正则表达式中有贪婪匹配和最小匹配:如下为贪婪匹配(.*) import re match = re.search(r'PY.*', 'P ...

  7. Android调用打印机

    打印机其实和Android没有什么大的关系,和linux内核关联才是比较强的. 最终的结果是要在Android实现驱动打印机,但是一般调试一个新的驱动的流程是这样的:1.先在linux PC上进行测试 ...

  8. C# copy files from source directory to destination file and rename repeated files and does not override

    static void CopyFiles() { string sourceDir = @"D:\C\ll"; string destDir = @"D:\LL&quo ...

  9. TreeMap源码分析,看了都说好

    概述 TreeMap也是Map接口的实现类,它最大的特点是迭代有序,默认是按照key值升序迭代(当然也可以设置成降序).在前面的文章中讲过LinkedHashMap也是迭代有序的,不过是按插入顺序或访 ...

  10. android studio 菜单中的app运行按钮上有个叉号,原因与解决办法(自己去百度)

    http://blog.csdn.net/sz0268/article/details/51706397 : 在Android studio写代码中,直接建立项目,写代码然后运行是不会一般是不会出现这 ...