美文网首页
Codeforces 1347A - A+B (Trial Pr

Codeforces 1347A - A+B (Trial Pr

作者: 费城的二鹏 | 来源:发表于2020-06-09 19:56 被阅读0次

日常一道算法题。卡题了,先选旧题水水。

翻译

A + B

给你两个数字 a 和 b 输出 a + b。

输入格式

输入整数 t 表示测试用例组数。

输出格式

每一组测试用例输出 a + b 的结果。

分析

直接输出 a + b。

代码(kotlin)

// https://codeforces.com/contest/1347/problem/A

import java.io.*
import kotlin.math.max

private var br: BufferedReader? = null

private fun br(): BufferedReader? {
    if (br == null) {
        var isLocal = false
        val file = File("./file/input.txt")

        try {
            isLocal = file.exists()
        } catch (e: Exception) {

        }

        br = if (isLocal) {
            BufferedReader(BufferedReader(FileReader(file)));
        } else {
            BufferedReader(InputStreamReader(System.`in`))
        }
    }
    return br
}

private fun readLn() = br()?.readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readLong() = readLn().toLong() // single long
private fun readDouble() = readLn().toDouble() // single double
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints
private fun readLongs() = readStrings().map { it.toLong() } // list of longs
private fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles
private fun readArray() = readStrings().map { it.toInt() }.toIntArray() // list of ints

fun case() {
    var (a, b) = readInts()
    println(a + b)
}

fun main() {
    var t = readInt()
    while (t-- > 0) {
        case()
    }
}

更多代码尽在 https://github.com/Tconan99/Codeforces

by 费城的二鹏 2020.06.08 长春

相关文章

  • Codeforces 1347A - A+B (Trial Pr

    日常一道算法题。卡题了,先选旧题水水。 翻译 A + B 给你两个数字 a 和 b 输出 a + b。 输入格式 ...

  • Codeforces Round #697 (Div. 3)

    C. Ball in Berland[https://codeforces.com/contest/1475/pr...

  • trial

    testing

  • trial

    Lied together, fucked together, parted forever

  • 2019-05-15_16-lengthOfLongestSub

    string array map first trial: second trial05-1609:00 - 10...

  • trial2

    trial2

  • 思维导图——架构师

    XMind - Trial Version

  • Trial and Error

    哈哈 发现我的英语真的都是初中高中的时候学的。 养娃过程就是一个Trial and Error的过程,不断试错,找...

  • RSpec Trial

    开篇 这篇Deck是近期对RSpec测试框架的一个Session总结,参考了RSpec官方文档和Better Rs...

  • Trial Lawyer

    周三的时候,我结束第一场关于老奶奶的庭审。坦率讲这是我到目前为止处理的最复杂的案子。我本来想要写一篇惊天地泣鬼神的...

网友评论

      本文标题:Codeforces 1347A - A+B (Trial Pr

      本文链接:https://www.haomeiwen.com/subject/fqbdtktx.html