개요
- BOJ 10250 ACM 호텔
Java
import java.util.Scanner;
public class Main {
private static int getRoom(int h, int w, int n) {
int y = n % h;
int x = n / h + 1;
if( y == 0 ) {
x--;
y = h;
}
return 100*y + x;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int c = sc.nextInt();
for (int i=0; i<c; i++) {
int h = sc.nextInt();
int w = sc.nextInt();
int n = sc.nextInt();
System.out.println( getRoom(h,w,n) );
}
}
}
PHP
<?php
$tt = intval(fgets(STDIN));
for($t=0; $t<$tt; $t++) {
fscanf(STDIN, '%d %d %d', $h, $w, $n);
echo ($n-1)%$h*100 + intdiv($n-1,$h) + 101 . "\n";
}
Python
tt = int(input())
for t in range(tt):
h, w, n = map(int,input().split())
print( (n-1)%h*100 + (n-1)//h + 101 )