2292번
import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
int num = Integer.parseInt(bf.readLine());
int cnt= 1;
int A= 1;
for (int i = 6; i>0; i+=6) {
if (num == 1) {
break;
}
cnt+=i;
A++;
if (cnt >= num) {
break;
}
}
System.out.println(A);
}
}
2869번
import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(bf.readLine());
double m = Integer.parseInt(st.nextToken());
double n = Integer.parseInt(st.nextToken());
double h = Integer.parseInt(st.nextToken());
double day = (h-n) / (m-n);
if ((h - n) % (m - n) != 0) {
day++;
}
System.out.println((int) day);
}
}
수학적 사고가...
10250번
import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st;
int num = Integer.parseInt(bf.readLine());
for (int i = 0; i< num; i++) {
st = new StringTokenizer(bf.readLine());
int h = Integer.parseInt(st.nextToken());
int w = Integer.parseInt(st.nextToken());
int n = Integer.parseInt(st.nextToken());
int a = n / h;
int b = n - (a * h);
if (b == 0) {
b = h;
a--;
}
if (a < 10 && a != 9) {
a++;
System.out.println(b+"0"+a);
} else {
a++;
System.out.println(b+""+a);
}
}
}
}
1193번
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int X = in.nextInt();
int cross_count = 1, prev_count_sum = 0;
while (true) {
if (X <= prev_count_sum + cross_count) {
if (cross_count % 2 == 1) {
System.out.print((cross_count - (X - prev_count_sum - 1)) + "/" + (X - prev_count_sum));
break;
}
else {
System.out.print((X - prev_count_sum) + "/" + (cross_count - (X - prev_count_sum - 1)));
break;
}
} else {
prev_count_sum += cross_count;
cross_count++;
}
}
}
}
2775번
import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
int tc = Integer.parseInt(bf.readLine());
int[][] arr = new int[16][16];
for (int i = 1; i<16; i++) {
for (int j = 2; j<16; j++) {
if (i == 1) {
arr[i][j] = j-1;
} else if (j == 2) {
arr[i][j] = 1;
} else {
arr[i][j] = arr[i-1][j]+arr[i][j-1];
}
}
}
for (int i = 0; i<tc; i++) {
int k = Integer.parseInt(bf.readLine());
int n = Integer.parseInt(bf.readLine());
System.out.println(arr[k+1][n+1]);
}
}
}
10757번
import java.math.BigInteger;
import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(bf.readLine());
BigInteger A = new BigInteger(st.nextToken());
BigInteger B = new BigInteger(st.nextToken());
A = A.add(B);
System.out.println(A.toString());
}
}
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine(), " ");
String str_A = st.nextToken();
String str_B = st.nextToken();
int max_length = Math.max(str_A.length(), str_B.length());
int[] A = new int[max_length + 1];
int[] B = new int[max_length + 1];
for(int i = str_A.length() - 1, idx = 0; i >= 0; i--, idx++) {
A[idx] = str_A.charAt(i) - '0';
}
for(int i = str_B.length() - 1, idx = 0; i >= 0; i--, idx++) {
B[idx] = str_B.charAt(i) - '0';
}
for(int i = 0; i < max_length; i++) {
int value = A[i] + B[i];
A[i] = value % 10;
A[i + 1] += (value / 10);
}
StringBuilder sb = new StringBuilder();
if(A[max_length] != 0) {
sb.append(A[max_length]);
}
for(int i = max_length - 1; i >= 0; i--) {
sb.append(A[i]);
}
System.out.println(sb);
}
}