更新
|
Before Width: | Height: | Size: 2.4 MiB After Width: | Height: | Size: 2.4 MiB |
|
Before Width: | Height: | Size: 2.4 MiB After Width: | Height: | Size: 2.4 MiB |
|
Before Width: | Height: | Size: 2.4 MiB After Width: | Height: | Size: 2.4 MiB |
|
Before Width: | Height: | Size: 2.5 MiB After Width: | Height: | Size: 2.5 MiB |
|
Before Width: | Height: | Size: 2.5 MiB After Width: | Height: | Size: 2.5 MiB |
|
Before Width: | Height: | Size: 2.5 MiB After Width: | Height: | Size: 2.5 MiB |
|
Before Width: | Height: | Size: 2.4 MiB After Width: | Height: | Size: 2.4 MiB |
|
Before Width: | Height: | Size: 2.4 MiB After Width: | Height: | Size: 2.4 MiB |
|
Before Width: | Height: | Size: 2.4 MiB After Width: | Height: | Size: 2.4 MiB |
|
Before Width: | Height: | Size: 2.5 MiB After Width: | Height: | Size: 2.5 MiB |
|
Before Width: | Height: | Size: 2.5 MiB After Width: | Height: | Size: 2.5 MiB |
|
Before Width: | Height: | Size: 2.5 MiB After Width: | Height: | Size: 2.5 MiB |
@@ -0,0 +1,20 @@
|
||||
import java.util.*;
|
||||
|
||||
public class P2981 {
|
||||
public static void main(String[] args) {
|
||||
Scanner in = new Scanner(System.in);
|
||||
List<Long> nums = new ArrayList<>();
|
||||
while (in.hasNextLong()) nums.add(in.nextLong());
|
||||
int pos = 0, neg = 0, zero = 0, even = 0, odd = 0;
|
||||
for (long x : nums) {
|
||||
if (x == 0) zero++; else if (x > 0) pos++; else neg++;
|
||||
if ((x & 1) == 0) even++; else odd++;
|
||||
}
|
||||
System.out.println(pos);
|
||||
System.out.println(neg);
|
||||
System.out.println(zero);
|
||||
System.out.println(even);
|
||||
System.out.println(odd);
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 2.5 MiB |
@@ -0,0 +1,40 @@
|
||||
import java.util.*;
|
||||
|
||||
public class P2972 {
|
||||
static String trimLeadingZeros(String s) {
|
||||
int i = 0;
|
||||
while (i < s.length() - 1 && s.charAt(i) == '0') i++;
|
||||
return s.substring(i);
|
||||
}
|
||||
|
||||
static String multiplyBy13(String num) {
|
||||
boolean neg = false;
|
||||
int start = 0;
|
||||
if (num.startsWith("-")) { neg = true; start = 1; }
|
||||
String s = num.substring(start);
|
||||
int n = s.length();
|
||||
int carry = 0;
|
||||
StringBuilder sb = new StringBuilder(n + 4);
|
||||
for (int i = n - 1; i >= 0; i--) {
|
||||
int d = s.charAt(i) - '0';
|
||||
int t = d * 13 + carry;
|
||||
sb.append((char)('0' + (t % 10)));
|
||||
carry = t / 10;
|
||||
}
|
||||
while (carry > 0) {
|
||||
sb.append((char)('0' + (carry % 10)));
|
||||
carry /= 10;
|
||||
}
|
||||
String res = sb.reverse().toString();
|
||||
res = trimLeadingZeros(res);
|
||||
if (res.equals("0")) return "0";
|
||||
return neg ? ("-" + res) : res;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Scanner in = new Scanner(System.in);
|
||||
String s = in.hasNext() ? in.next() : "0";
|
||||
System.out.println(multiplyBy13(s));
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 2.5 MiB |
@@ -0,0 +1,23 @@
|
||||
import java.util.*;
|
||||
|
||||
public class P2973 {
|
||||
static long modPow(long base, long exp, long mod) {
|
||||
base %= mod;
|
||||
long res = 1 % mod;
|
||||
while (exp > 0) {
|
||||
if ((exp & 1) == 1) res = (res * base) % mod;
|
||||
base = (base * base) % mod;
|
||||
exp >>= 1;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Scanner in = new Scanner(System.in);
|
||||
long p = in.nextLong();
|
||||
long g = in.nextLong();
|
||||
long a = in.nextLong();
|
||||
System.out.println(modPow(g, a, p));
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 2.5 MiB |