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[ ...
随机推荐
- 06 HTTP协议缓存控制
一:HTTP协议缓存控制 第1次请求时 200 ok 第2次请求时 304 Not Modified 未修改状态 解释: 在网络上,有一些缓存服务器,另, 浏览器自身也有缓存功能. 当我们第一次某图片 ...
- 零基础学python-2.18 异常
这一节说一下异常except 继续沿用上一节的代码.我有益把文件名称字搞错.然后在结尾部分加上异常捕捉: try: handler=open("12.txt")#在这里我特别将文件 ...
- OpenStack部署到Hadoop的四种方案
随着企业開始同一时候利用云计算和大数据技术.如今应当考虑怎样将这些工具结合使用.在这样的情况下,企业将实现最佳的分析处理能力.同一时候利用私有云的高速弹性 (rapid elasticity) 和单一 ...
- wince c# 创建桌面快捷方式 自动启动 只运行一次 全屏显示
using System; using System.Linq; using System.Collections.Generic; using System.Text; using System.R ...
- src/github.com/mongodb/mongo-go-driver/mongo/cursor.go 游标的简洁实用
src/github.com/mongodb/mongo-go-driver/mongo/cursor.go // Copyright (C) MongoDB, Inc. 2017-present./ ...
- some base knowledge
har类型的长度被定义为一个8位字节,这很简单. short类型的长度至少为两字节.在有些计算机上,对于有些编译程序,short类型的长度可能为4字节,或者更长. int类型是一个整数的“自然”大小, ...
- 软件版本GA,RC,alpha,beta含义
软件版本GA,RC,alpha,beta含义 (1)RC:(Release Candidate) Candidate是候选人的意思,用在软件上就是候选版本.Release.Candidate.就是发行 ...
- AndroidPageObjectTest_Chained.java
以下代码使用ApiDemos-debug.apk进行测试 //这个脚本用于演示PageFactory的功能:链式注解@AndroidFindBys.@IOSFindBys.具体用法参考页面类的代码. ...
- HZNU 2154 ldh发奖金【字符串】
题目链接 http://acm.hznu.edu.cn/OJ/problem.php?id=2154 思路 先判断不能拆分的情况 以为需要拆分成两个正整数 所以我们可以知道 只有个位的数字 是不能够拆 ...
- linux 启动引导器 grub,单用户模式:
Linux启动引导器 安装linux操作系统的时候就已经将启动引导器安装到硬盘上去了,才能通过硬盘的读取方式启动操作系统. 引导器分为2种: Lilo:功能比较简单,使用比较麻烦,后续发行版中使用gr ...