zoukankan      html  css  js  c++  java
  • AtCoder Beginner Contest 113 A

    A - Discount Fare


    Time limit : 2sec / Memory limit : 1024MB

    Score: 100 points

    Problem Statement

    There is a train going from Station A to Station B that costs X yen (the currency of Japan).

    Also, there is a bus going from Station B to Station C that costs Y yen.

    Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus.

    How much does it cost to travel from Station A to Station C if she uses this ticket?

    Constraints

    • 1≤X,Y≤100
    • Y is an even number.
    • All values in input are integers.

    Input

    Input is given from Standard Input in the following format:

    X Y
    

    Output

    If it costs x yen to travel from Station A to Station C, print x.


    Sample Input 1

    Copy
    81 58
    

    Sample Output 1

    Copy
    110
    
    • The train fare is 81 yen.
    • The train fare is 58 ⁄ 2=29 yen with the 50% discount.

    Thus, it costs 110 yen to travel from Station A to Station C.


    Sample Input 2

    Copy
    4 54
    

    Sample Output 2

    Copy
    31

    #include <iostream>
    #include <algorithm>
    #include <cstring>
    #include <cstdio>
    #include <vector>
    #include <queue>
    #include <stack>
    #include <cstdlib>
    #include <iomanip>
    #include <cmath>
    #include <cassert>
    #include <ctime>
    #include <cstdlib>
    #include <map>
    #include <set>
    using namespace std;
    #pragma comment(linker, "/stck:1024000000,1024000000")
    #define lowbit(x) (x&(-x))
    #define max(x,y) (x>=y?x:y)
    #define min(x,y) (x<=y?x:y)
    #define MAX 100000000000000000
    #define MOD 1000000007
    #define pi acos(-1.0)
    #define ei exp(1)
    #define PI 3.1415926535897932384626433832
    #define ios() ios::sync_with_stdio(true)
    #define INF 1044266558
    #define mem(a) (memset(a,0,sizeof(a)))
    int main()
    {
        int x,y;
        cin>>x>>y;
        cout<<x+y/2<<endl;
        return 0;
    }
  • 相关阅读:
    qt tableview中如何添加右键菜单且不可编辑单元格
    C++typedef struct和struct的区别
    Qt5配置winpCap
    C++虚函数和纯虚函数的用法和区别
    c++11 智能指针 unique_ptr、shared_ptr与weak_ptr
    C++ windows进程间通信
    C++并发多线程(一)
    Maven无法下载2.1.7.js7版本的itext依赖
    PostgreSQL
    SQL
  • 原文地址:https://www.cnblogs.com/yinghualuowu/p/9906666.html
Copyright © 2011-2022 走看看