5554

thinkpius
yxc
acwing_52274

RageAgainsttheMachine
succyag
bakkali

R虎虎生威R
LeoRiver
AAAL

9104
Yoursalt
Sign
SELFIE1

3天前
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();

int cx = n / 2, cy = n / 2;
for (int i = 0; i < n; i ++ ) {
for (int j = 0; j < n; j ++ ) {
int d = Math.abs(i - cx) + Math.abs(j - cy);
if (d <= n / 2)
System.out.printf("*");
else
System.out.printf(" ");
}
System.out.println();
}
}
}


3天前
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();

while (n -- > 0) {
int x = sc.nextInt();
boolean isPrime = true;
for (int i = 2; i * i <= x; i ++ )
if (x % i == 0) {
isPrime = false;
break;
}
if (isPrime)
System.out.printf("%d is prime\n", x);
else
System.out.printf("%d is not prime\n", x);
}
}
}


3天前
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();

while (n -- > 0) {
int x = sc.nextInt();
int sum = -x;
for (int i = 1; i * i <= x; i ++ )
if (x % i == 0) {
sum += i;
if (i != x / i) sum += x / i;
}

if (sum == x)
System.out.printf("%d is perfect\n", x);
else
System.out.printf("%d is not perfect\n", x);
}
}
}


3天前
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (true) {
int n = sc.nextInt(), m = sc.nextInt();
if (n <= 0 || m <= 0) break;

if (n > m) {
int t = n;
n = m;
m = t;
}

int sum = 0;
for (int i = n; i <= m; i ++ ) {
System.out.printf("%d ", i);
sum += i;
}

System.out.printf("Sum=%d\n", sum);
}
}
}


3天前
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();

int a = 0, b = 1;
for (int i = 0; i < n; i ++ ) {
System.out.printf("%d ", a);
int c = a + b;
a = b;
b = c;
}
}
}


3天前
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();

while (n -- > 0) {
int x = sc.nextInt(), y = sc.nextInt();
if (x > y) {
int t = x;
x = y;
y = t;
}

int sum = 0;
for (int i = x + 1; i < y; i ++ )
if (i % 2 != 0)
sum += i;

System.out.println(sum);
}
}
}


3天前
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();

int in = 0, out = 0;
while (n -- > 0) {
int x = sc.nextInt();
if (x >= 10 && x <= 20) in ++ ;
else out ++ ;
}

System.out.printf("%d in\n", in);
System.out.printf("%d out\n", out);
}
}


3天前
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();

int c = 0, r = 0, f = 0, tot = 0;
while (n -- > 0) {
int a = sc.nextInt();
String t = sc.next();
tot += a;
if ("C".equals(t)) c += a;
else if ("R".equals(t)) r += a;
else f += a;
}

System.out.printf("Total: %d animals\n", tot);
System.out.printf("Total coneys: %d\n", c);
System.out.printf("Total rats: %d\n", r);
System.out.printf("Total frogs: %d\n", f);
System.out.printf("Percentage of coneys: %.2f %%\n", c * 100.0 / tot);
System.out.printf("Percentage of rats: %.2f %%\n", r * 100.0 / tot);
System.out.printf("Percentage of frogs: %.2f %%\n", f * 100.0 / tot);
}
}


3天前
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 1; i <= 10; i ++ )
System.out.printf("%d x %d = %d\n", i, n, i * n);
}
}


3天前
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
if (x % 2 == 0) x ++ ;

for (int i = 0; i < 6; i ++ )
System.out.println(x + i * 2);
}
}