NC52892. Higher h-index
描述
输入描述
The input consists of several test cases and is terminated by end-of-file.Each test case contains two integers n and a.*
** The number of test cases does not exceed .
输出描述
For each test case, print an integer which denotes the maximum h-index.
示例1
输入:
3 0 3 1 1000000000 1000000000
输出:
1 2 1000000000
C(clang 3.9) 解法, 执行用时: 6ms, 内存消耗: 376K, 提交时间: 2020-01-31 17:09:07
#include <stdio.h> int main(){ int n,a; while(scanf("%d%d",&n,&a)!=EOF){ printf("%d\n",a+(n-a)/2); } return 0; }
C++11(clang++ 3.9) 解法, 执行用时: 8ms, 内存消耗: 380K, 提交时间: 2020-02-25 20:58:14
#include<stdio.h> int main() { int x,a; while(scanf("%d %d\n",&x,&a)!=EOF) { printf("%d\n",(a+x)/2); } }
Python3(3.5.2) 解法, 执行用时: 94ms, 内存消耗: 3552K, 提交时间: 2019-10-02 12:50:49
while True: try: n,m=map(int,input().split()) print((n+m)//2) except: break
C++14(g++5.4) 解法, 执行用时: 24ms, 内存消耗: 340K, 提交时间: 2019-10-02 13:44:30
#include<bits/stdc++.h> int main(){int n,a;while(std::cin>>n>>a)printf("%d\n",a+(n-a)/2);}