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[ ...
随机推荐
- 九度OJ 1115:数字求和 (基础题)
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:2396 解决:1507 题目描述: 给定一个正整数a,以及另外的5个正整数,问题是:这5个整数中,小于a的整数的和是多少? 输入: 输入一行 ...
- mybatis入门(七)
mybatis入门--添加一个用户 //添加用户 @Test public void insertUserTest() throws IOException { // 通过工厂得到SqlSession ...
- SpringBoot-(6)-日志SLF4j
一,日志简介: 目前有很多日志框架,SpringBoot内部采用了SLF4j+logback的形式. SpringBoot内部日志库依赖关系如下: 二,日志的分级 常用的Log日志分级如下: /* * ...
- 03-树2 List Leaves(25 point(s)) 【Tree】
03-树2 List Leaves(25 point(s)) Given a tree, you are supposed to list all the leaves in the order of ...
- spring+mybatis项目整合
前辈总结的很详细,贴出链接,参考学习 http://www.open-open.com/lib/view/open1392252233301.html
- HDU2049 不容易系列之(4)考新郎 —— 错排
题目链接:https://vjudge.net/problem/HDU-2049 不容易系列之(4)——考新郎 Time Limit: 2000/1000 MS (Java/Others) Me ...
- hadoop内存分配方案
Configuration File Configuration Setting Value Calculation 8G VM (4G For MR) yarn-site.x ...
- codeforces B. Calendar 解题报告
题目链接:http://codeforces.com/problemset/problem/304/B 题目意思:给出两个日期,需要算出这两个日期之间有多少日. 细心模拟就可以了.特别要注意的是,两个 ...
- html5--3.16 button元素
html5--3.16 button元素 学习要点 掌握button元素的使用 button元素 用来建立一个按钮从功能上来说,与input元素建立的按钮相同 button元素是双标签,其内部可以配置 ...
- easyui tree 树形节点 formatter 渲染不起作用
接了个需求,需要对一个树形列表进行重新渲染,在进行渲染的过程中发现树形节点的formatter 属性无法生效.经反复测试,发现在外部环境中正常,但在项目环境中始终无效.最终发现问题出在 easyui ...