2016四川省赛A,C【写了1w个if的水题】
A题:
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <queue>
#include <math.h>
using namespace std;
typedef long long LL;
const int MAX=100010;
int n,m;
int a[MAX],b[MAX];
int main()
{
int i,j,k,t,l;
int a,b,c;
while(~scanf("%d%d%d",&a,&b,&c))
{
int sum=0;
int a1,a2,b1,b2,c1,c2;
scanf("%d%d%d",&a1,&b1,&c1);
scanf("%d%d%d",&a2,&b2,&c2);
if(a>=a2)
sum+=(a-a2)*(a-a2);
else if(a<=a1)
sum+=(a1-a)*(a1-a);
if(b>=b2)
sum+=(b-b2)*(b-b2);
else if(b<=b1)
sum+=(b1-b)*(b1-b);
if(c>=c2)
sum+=(c-c2)*(c-c2);
else if(c<=c1)
sum+=(c1-c)*(c1-c);
printf("%d\n",sum);
}
return 0;
}
C题:
#include <bits/stdc++.h>
using namespace std; typedef long long LL; int main()
{
LL a,b,c;
LL sum;
scanf("%lld%lld%lld",&a,&b,&c);
sum=a+2*b+3*c;
if(!a&&!b&&!c)
{
puts("0");
}
if(a==0&&b==0&&c)
{
printf("%lld\n",sum/3);
}
if(a>=1&&b>=1&&c)
{
printf("%lld\n",sum);
}
if(a>=2&&b==0&&c)
{
printf("%lld\n",sum);
}
if(a==1&&!b&&c)
{
printf("%lld\n",sum*2/3+1);
}
if(a==0&&b==1&&c)
{
printf("%lld\n",2*sum/3);
}
if(a==0&&b>=2&&c)
{
printf("%lld\n",sum-2);
}
if(!a&&b&&!c)
{
printf("%lld\n",sum/2);
}
if(a&&b&&!c)
{
printf("%lld\n",sum);
}
if(a&&!b&&!c)
{
printf("%lld\n",sum);
}
return 0;
}
2016四川省赛A,C【写了1w个if的水题】的更多相关文章
- 2016四川省赛 Floyd-Warshall
这题真的有毒 首先你忽略 N-M < 100 的条件你就gg吧 其次就算你知道了怎么做之后 还有可能因为写vector或者各种常数大的原因被卡 #include<iostream> ...
- uva 110 Meta-Loopless Sorts 用程序写程序 有点复杂的回溯水题
题目要求写一个直接用比较排序的pascal程序,挺有趣的一题. 我看题目数据范围就到8,本来以为贪个小便宜,用switch输出. 然后发现比较次数是阶乘级别的,8的阶乘也是挺大的,恐怕会交不上去. 于 ...
- Codeforces Round #348 (VK Cup 2016 Round 2, Div. 2 Edition) A. Little Artem and Presents 水题
A. Little Artem and Presents 题目连接: http://www.codeforces.com/contest/669/problem/A Description Littl ...
- VK Cup 2016 - Round 1 (Div. 2 Edition) A. Bear and Reverse Radewoosh 水题
A. Bear and Reverse Radewoosh 题目连接: http://www.codeforces.com/contest/658/problem/A Description Lima ...
- 【2019.7.24 NOIP模拟赛 T1】道路建设(road)(水题)
原题与此题 原题是一道神仙不可做题,两者区别在于,原题不能有重边和自环. 然而,这题可以有重边... 于是这题就变成了一道大水题. 此题的解法 考虑如何构造. 对于\(n\le10^4\)的情况: 对 ...
- 2016湖南省赛----G - Parenthesis (括号匹配)
2016湖南省赛----G - Parenthesis (括号匹配) Bobo has a balanced parenthesis sequence P=p 1 p 2…p n of lengt ...
- 2016湖南省赛----A 2016 (同余定理)
2016湖南省赛----A 2016 (同余定理) Description 给出正整数 n 和 m,统计满足以下条件的正整数对 (a,b) 的数量: 1. 1≤a≤n,1≤b≤m; 2. a×b 是 ...
- 2016湖南省赛 I Tree Intersection(线段树合并,树链剖分)
2016湖南省赛 I Tree Intersection(线段树合并,树链剖分) 传送门:https://ac.nowcoder.com/acm/contest/1112/I 题意: 给你一个n个结点 ...
- ytu 1050:写一个函数,使给定的一个二维数组(3×3)转置,即行列互换(水题)
1050: 写一个函数,使给定的一个二维数组(3×3)转置,即行列互换 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 154 Solved: 112[ ...
随机推荐
- 基于TCP的一对回射客户/服务器程序及其运行过程分析( 下 )
执行分析 1. 打开服务器进程: 2. 执行netstat -a命令观察当前的连接状态: 第1条连接记录说明:绑定了本地主机的任意IP,端口为9877,目前处于监听状态. 3. 打开客户进程: 4. ...
- 负载均衡实现,一个域名对应多个IP地址
负载均衡实现,一个域名对应多个IP地址 - 宏宇 - 博客园 https://www.cnblogs.com/cuihongyu3503319/archive/2012/07/09/2583129.h ...
- MySql in子句 效率低下优化(亲测有效,从200秒变1秒)
MySql in子句 效率低下优化 背景: 更新一张表中的某些记录值,更新条件来自另一张含有200多万记录的表,效率极其低下,耗时高达几分钟. update clear_res set candele ...
- Strans 内表-xml文件
一.内表到xml文件 <?sap.transform simple?> <tt:transform xmlns:tt="http://www.sap.com/transfo ...
- SpringBoot-(7)-基于Web,JDBC,MySql,Druid,MyBatis整合创建SpringBoot项目
1 打开Spring Initializr 如果Project SDK为空,手动指定下JDK SDK路径 2, 填写Group和Artifact 3,选择依赖 选择Web,MySQL,JDBC,MyB ...
- jps不显示java进程信息
本来想自己整理,发现已经有前人整理,并且完美解决了我的问题,故转载,感谢分享 转自:http://trinea.iteye.com/blog/1196400 对于jps较熟悉可以直接查看第二部分的分析 ...
- protoc: error while loading shared libraries: libprotoc.so.9: cannot open shared object
使用protobuf出错:protoc: error while loading shared libraries: libprotoc.so.9: cannot open shared object ...
- eclipse 中PlantUML的安装和使用
安装: 填写的地址:http://hallvard.github.io/plantuml/ 安装完plantUML后,还要下载一个Graphviz https://pan.baidu.com/s/1g ...
- Eclipse快捷键【转载】
分享一前辈的博客-Eclipse快捷键
- HDU4965 Fast Matrix Calculation —— 矩阵乘法、快速幂
题目链接:https://vjudge.net/problem/HDU-4965 Fast Matrix Calculation Time Limit: 2000/1000 MS (Java/Othe ...