結果
| 問題 |
No.1934 Four Fruits
|
| コンテスト | |
| ユーザー |
ripity
|
| 提出日時 | 2022-05-13 21:23:14 |
| 言語 | Kotlin (2.1.0) |
| 結果 |
AC
|
| 実行時間 | 312 ms / 2,000 ms |
| コード長 | 2,737 bytes |
| コンパイル時間 | 14,190 ms |
| コンパイル使用メモリ | 460,152 KB |
| 実行使用メモリ | 57,944 KB |
| 最終ジャッジ日時 | 2024-07-22 00:51:36 |
| 合計ジャッジ時間 | 17,733 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 |
ソースコード
import java.io.*
import java.util.*
import kotlin.math.*
fun main() {
solve()
pw.flush()
}
fun solve() {
val N = 3
val a = nextIntarr(N).sorted()
if( a[0] != a[1] && a[1] != a[2] ) pw.println(6-a.sum())
else if( a[0] == a[1] && a[1] == a[2] ) pw.println(a[0])
else if( a[0] == a[1] ) pw.println(a[2])
else pw.println(a[0])
}
/* struct begin */
data class Point(val x: Int, val y: Int)
data class Edge(val from: Int, val to: Int, val w: Long)
class BinaryIndexedTree(n: Int) {
val N = n
var a = Array<Long>(N+1) {0L}
fun sum(i: Int): Long {
var idx = i+1
var res = 0L
while( idx > 0 ) {
res += a[idx]
idx -= idx and (-idx)
}
return res
}
fun add(i: Int, x: Long) {
var idx = i+1
while( idx <= N ) {
a[idx] += x
idx += idx and (-idx)
}
}
}
class UnionFind(N: Int) {
var parent = Array<Int>(N) {it}
var rank = Array<Int>(N) {1}
var size = Array<Int>(N) {1}
fun root(x: Int): Int {
if( parent[x] == x ) {
return x
}else {
parent[x] = root(parent[x])
return parent[x]
}
}
fun unite(x: Int, y: Int) {
val rx = root(x)
val ry = root(y)
if( rx == ry ) return
if( rank[rx] > rank[ry] ) {
parent[ry] = rx
size[rx] += size[ry]
}else {
parent[rx] = ry
size[ry] += size[rx]
if( rank[rx] == rank[ry] ) rank[ry]++
}
}
fun same(x: Int, y: Int): Boolean = (root(x) == root(y))
fun getSize(x: Int): Int = size[root(x)]
}
/* struct end */
/* math begin */
fun intceil(x: Double) = ceil(x).toInt()
fun intfloor(x: Double) = floor(x).toInt()
fun gcd(x: Int, y: Int): Int {
var a = max(x, y)
var b = min(x, y)
var r: Int
do {
r = a%b
a = b
b = r
}while( r > 0 )
return a
}
/* math end */
/* I/O begin */
var st = StringTokenizer("")
val br = System.`in`.bufferedReader()
val pw = PrintWriter(System.out, false)
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextLine() = br.readLine()!!
fun nextDouble() = next().toDouble()
fun nextIntarr(n: Int) = Array<Int>(n) {nextInt()}
fun nextStrarr(n: Int) = Array<String>(n) {next()}
fun nextLongarr(n: Int) = Array<Long>(n) {nextLong()}
fun next(): String {
while( !st.hasMoreTokens() ) st = StringTokenizer(br.readLine()!!)
return st.nextToken()
}
/* I/O end */
ripity