作为我在这个OJ玩了一下午的终结吧。

水题一道,阅读理解OJ。

传送门:点我

Taxi

At the peak hour, three taxi buses drove up at the same time, following one route, where the passengers immediately got crowded. The drivers found that the number of people in taxis is different, so they decided to relocate a part of passengers so that in each minibus there will be an equal number of passengers. Determine what is the fewest number of passengers have to be relocated at the same time.

Input

Three integers not greater than 100 - the number of passengers in the first, second and third taxi bus.

Output

Print one number - the minimum number of passengers that must be relocated. If its not possible, print the word IMPOSSIBLE (with capital letters).

Time limit 1 second
Memory limit 128 MiB
Input example #1
1 2 3
Output example #1
1

题意:给定三个数,如果能均分那么输出最小的挪动个数,如果不能则输出IMPOSSIBLE。
样例解释:1 2 3,把3挪一个到1,那么就变成了2 2 2,即均分。
思路:如果和余3不等0,那么肯定不行。
如果和余3等于0,直接看代码吧。。。。
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <bitset> using namespace std;
#define LL long long
#define pb push_back
#define mk make_pair
#define pill pair<int, int>
#define REP(i, x, n) for(int i = x; i <= n; ++i)
int Scan()
{
int res = , ch, flag = ;
if((ch = getchar()) == '-')
flag = ;
else if(ch >= '' && ch <= '')
res = ch - '';
while((ch = getchar()) >= '' && ch <= '' )
res = res * + ch - '';
return flag ? -res : res;
}
int main(){
int x,a[];
cin>>a[]>>a[]>>a[];
int sum = a[]+a[]+a[];
if(sum % != ){
puts("IMPOSSIBLE");
}else{
sum = sum/;
int ans = ;
for(int i = ; i < ; i++){
if(a[i] < sum) ans+=(sum-a[i]);
}
printf("%d\n",ans);
}
}

e-olymp Problem8352 Taxi的更多相关文章

  1. 【HDU1960】Taxi Cab Scheme(最小路径覆盖)

    Taxi Cab Scheme Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)T ...

  2. A cost-effective recommender system for taxi drivers

    一个针对出租车司机有效花费的推荐系统 摘要 GPS技术和新形式的城市地理学改变了手机服务的形式.比如说,丰富的出租车GPS轨迹使得出做租车领域有新方法.事实上,最近很多工作是在使用出租车GPS轨迹数据 ...

  3. poj 2060 Taxi Cab Scheme (二分匹配)

    Taxi Cab Scheme Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 5710   Accepted: 2393 D ...

  4. [ACM_数学] Taxi Fare [新旧出租车费差 水 分段函数]

    Description Last September, Hangzhou raised the taxi fares. The original flag-down fare in Hangzhou ...

  5. zjuoj 3600 Taxi Fare

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3600 Taxi Fare Time Limit: 2 Seconds    ...

  6. Taxi Trip Time Winners' Interview: 3rd place, BlueTaxi

    Taxi Trip Time Winners' Interview: 3rd place, BlueTaxi This spring, Kaggle hosted two competitions w ...

  7. poj 2060 Taxi Cab Scheme (最小路径覆盖)

    http://poj.org/problem?id=2060 Taxi Cab Scheme Time Limit: 1000MS   Memory Limit: 30000K Total Submi ...

  8. The 9th Zhejiang Provincial Collegiate Programming Contest->Problem A:A - Taxi Fare

    Problem A: Taxi Fare Time Limit: 2 Seconds Memory Limit: 65536 KB Last September, Hangzhou raised th ...

  9. Taxi Cab Scheme POJ && HDU

    Online Judge Problem Set Authors Online Contests User Web Board Home Page F.A.Qs Statistical Charts ...

随机推荐

  1. Kali 局域网 DNS 劫持

    <一> 所需工具  1: Kali-linux-2017  2: ettercap 0.8.2 3: web 服务器, 这里以 node 为例 <二> 原理  1: DNS劫持 ...

  2. php实现SSO单点登录实例

    1.点击登录跳转到SSO登录页面并带上当前应用的callback地址2.登录成功后生成COOKIE并将COOKIE传给callback地址3.callback地址接收SSO的COOKIE并设置在当前域 ...

  3. [转]让linux的coredump文件

    原文标题:gdb结合coredump定位崩溃进程 原文:http://lazycat.is-programmer.com/posts/31925.html 这个文件中说的方法我试过了,在CentOS和 ...

  4. java中常用工具类

    目录 一. org.apache.commons.io.IOUtils 二. org.apache.commons.io.FileUtils 三. org.apache.commons.lang.St ...

  5. css3 - 特性

    伪类选择器 伪类选择器,不用再使用js来控制奇偶不同了 tr:nth-child(even){ background-color: white; } tr:nth-child(odd){ backgr ...

  6. UI5-学习篇-16-云端SCP-Destination配置

    1.登录路径: https://account.ap1.hana.ondemand.com/#/home/welcome 2.查看云连接器 如下图所示,虚拟主机都已连接且资源可用: 若虚拟主机连接存在 ...

  7. English-英语学习杂志及资料

    [英文原版杂志] >>经济学人 英文原版PDF+双语版+文本音频 超全下载!http://bbs.zhan.com/thread-8443-1-1.html?sid=2004 >&g ...

  8. java输出自身源代码

    如何通过运行程序输出程序源码? 下面是JAVA实现 public class Quine { public static void main(String[] args) { char q = 34; ...

  9. 对于两个初始时设置为Sensor的刚体,不会触发preSolve和postSolve

    Main.as package{ import Box2D.Common.Math.b2Vec2; import Box2D.Dynamics.b2Body; import Box2D.Dynamic ...

  10. ORA-00600: internal error code, arguments: [4193]问题解决

    操作环境 SuSE+Oracle11gR2 问题现象 单板宕机自动重启后,ORACLE运行不正常,主要表现如下: 1.执行shutdown immedate停止数据库时,提示ORA-00600: in ...