csp模拟题-201903
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的更多相关文章
- CSP复赛day2模拟题
没错,我又爆零了.....先让我自闭一分钟.....so 当你忘记努力的时候,现实会用一记响亮的耳光告诉你东西南北在哪. 好了,现在重归正题: 全国信息学奥林匹克联赛(NOIP2014) 复赛模拟题 ...
- csp模拟赛低级错误及反思
\(csp\)模拟赛低级错误及反思. 1.没开\(longlong\). 反思:注意数据类型以及数据范围. 2.数组越界(前向星数组未开两倍,一题的数据范围应用到另一题上,要开两倍的写法为开两倍数组) ...
- poj 1008:Maya Calendar(模拟题,玛雅日历转换)
Maya Calendar Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 64795 Accepted: 19978 D ...
- poj 1888 Crossword Answers 模拟题
Crossword Answers Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 869 Accepted: 405 D ...
- CodeForces - 427B (模拟题)
Prison Transfer Time Limit: 1000MS Memory Limit: 262144KB 64bit IO Format: %I64d & %I64u Sub ...
- sdut 2162:The Android University ACM Team Selection Contest(第二届山东省省赛原题,模拟题)
The Android University ACM Team Selection Contest Time Limit: 1000ms Memory limit: 65536K 有疑问?点这里 ...
- 全国信息学奥林匹克联赛 ( NOIP2014) 复赛 模拟题 Day1 长乐一中
题目名称 正确答案 序列问题 长途旅行 英文名称 answer sequence travel 输入文件名 answer.in sequence.in travel.in 输出文件名 answer. ...
- UVALive 4222 Dance 模拟题
Dance 题目连接: https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&pag ...
- cdoj 25 点球大战(penalty) 模拟题
点球大战(penalty) Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/show/2 ...
随机推荐
- Eclipse优化之设置不自动弹出控制台和Server
有时候Eclipse启动,控制台console不会自动跳出来,需要手工点击该选项卡才行, 按下面的设置,可以让它自动跳出来(或不跳出来): windows -> preferences ...
- super()方法详解
目录 一.单独调用父类的方法 二.super() 方法基本概念 2.1 描述 2.2 语法 2.3 单继承使用super() 2.4 多继承使用super() 三.注意事项 四.练习 一.单独调用父类 ...
- 详解JAVA8Stream API {全}
1: 概述 1.1 优势 1.2 与传统迭代器的区分 1.3 流的操作类型分为两种: 2:流的构造与转换 2:1 常见构造 2.2: 三大包装类型的构造 2.3 并行流的规则输出 2.4 流的转换 3 ...
- 支付签名 MD5Util 排序工具类
package com.skynet.wechat.wxPay.common; import java.security.MessageDigest; import java.util.Iterato ...
- 近日LeetCode算法(记录)
近日LeetCode算法 前言:最近刷了好多leetcode算法题,大家知道,程序=数据结构+算法,由此可见,算法真的是很重要的呢.闲话少谈,切入正题,来看看小编觉得有点意思的5题算法题吧... 1. ...
- oracle学习笔记(十) 查询练习(一)
查询练习一 表创建 create table employee as select * from soctt.emp ; --记得授权 sysdba用户登录 grant select on scott ...
- JQuery学习笔记(4)——ajax
AJAX = Asynchronous JavaScript and XML(异步的 JavaScript 和 XML) 原生 例子 点击按钮,访问服务器上的ajax_info.txt文件,获得txt ...
- 3DES对称加密算法(ABAP 语言实现版)
公司人事数据要求在系统间加密传输,而对接系统大部分是Java系统,要在不同的异构系统间能很好的加解密码,想到了标准的对称加密算法DES,因为是标准的算法,网络上存在大量公开用Java的DES算法,JA ...
- python基础(33):线程(一)
1. 线程概念的引入背景 1.1 进程 之前我们已经了解了操作系统中进程的概念,程序并不能单独运行,只有将程序装载到内存中,系统为它分配资源才能运行,而这种执行的程序就称之为进程.程序和进程的区别就在 ...
- django3-视图函数进阶
1.视图函数的分类 FBV(fucntion base view) CBV(class base view) ,CBV根据定义的方法名 ,判断什么请求执行什么函数 2.FBV转换CBV (不太对劲) ...