POJ 1. 压缩矩阵
原题链接
中等
作者:
ifei_2
,
2023-11-28 12:23:31
,
所有人可见
,
阅读 52
import java.util.*;
public class Main {
static int q;
static long n;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
n = sc.nextLong();
q = sc.nextInt();
for (int i = 1; i <= q; i ++ ) {
Long t = sc.nextLong();
if (t == 0) {
System.out.println(1 + " " + 1);
continue;
}
if (t == 1) {
System.out.println(1 + " " + 2);
continue;
}
long l = (t + 1) / 3 + 1;
System.out.print(l + " ");
long x = t % 3;
if (x == 2) x = -1;
else if (x == 1) x = 1;
System.out.println(l + x);
}
}
}
import java.util.Scanner;
// 1:无需package
// 2: 类名必须Main, 不可修改
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
//在此输入您的代码…
long n=scan.nextLong();
long q=scan.nextLong();
for(int i=0;i<q;i++){
long x= scan.nextLong()+1;
System.out.println((x/3+1)+” “+(x/3+x%3));
}
scan.close();
}
}
大佬
不是,俺是小白