結果
問題 | No.1986 Yummy |
ユーザー |
![]() |
提出日時 | 2022-06-26 12:24:42 |
言語 | Kotlin (2.1.0) |
結果 |
AC
|
実行時間 | 284 ms / 2,000 ms |
コード長 | 3,065 bytes |
コンパイル時間 | 18,958 ms |
コンパイル使用メモリ | 449,660 KB |
実行使用メモリ | 49,944 KB |
最終ジャッジ日時 | 2024-11-16 14:50:18 |
合計ジャッジ時間 | 25,420 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 24 |
ソースコード
import java.io.*import java.util.*import kotlin.math.*fun main() {// val T = nextInt()// repeat(T) {solve()}// pw.flush()solve()pw.flush()}fun solve() {val N = nextInt()pw.println( if( N%2 == 0 ) N/2 else 1 )}data class Vertice(val idx: Int, var deg: Int)/* struct begin */data class Cell(val r: Int, val c: Int)data class Point(val x: Long, val y: Long)data class Pii(val fi: Int, val se: Int)data class Edge(val to: Int, val w: Long)class BinaryIndexedTree(n: Int) {val N = nvar a = Array<Long>(N+1) {0L}fun sum(i: Int): Long {var idx = i+1var res = 0Lwhile( idx > 0 ) {res += a[idx]idx -= idx and (-idx)}return res}fun add(i: Int, x: Long) {var idx = i+1while( idx <= N ) {a[idx] += xidx += idx and (-idx)}}}class UnionFind(n: Int) {val N = nvar parent = Array<Int>(N) {it}var rank = 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 ) returnif( rank[rx] > rank[ry] ) {parent[ry] = rx}else {parent[rx] = ryif( rank[rx] == rank[ry] ) rank[ry]++}}fun same(x: Int, y: Int): Boolean = (root(x) == root(y))}/* struct end *//* math begin */fun intceil(x: Double) = ceil(x).toInt()fun intfloor(x: Double) = floor(x).toInt()fun gcd(x: Long, y: Long): Long {var a = max(abs(x), abs(y))var b = min(abs(x), abs(y))var r: Longdo {r = a%ba = bb = r}while( r > 0 )return a}fun modpow(X: Long, T: Long, P: Long = 9223372036854775807L): Long {var x = Xvar t = Tif( t == 0L ) {return 1L}else {var res = 1Lwhile( t > 0 ) {if( t%2L == 1L ) {res *= xres %= Pt -= 1L}x *= xx %= Pt /= 2}return res%P}}/* 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 */