3.1w+
社区成员
package lanqiaobei.exe.day13;
import java.util.Scanner;
public class 特殊日期01 {
static int[] days = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int y = 1900;
int m = 1;
int d = 1;
long ans = 0;
while (true) {
if (y == 9999 && m == 12 && d == 31){
break;
}
if (isEqual(y,m,d))ans++;
if (y % 4 == 0 && y % 100 != 0 || y % 400 == 0) {
days[2] = 29;
} else days[2] = 28;
if (d == days[m]) {
d = 1;
if (m == 12) {
m = 1;
y++;
} else m++;
} else d++;
}
System.out.println(ans);
}
static boolean isEqual(int y,int m,int d){
int a = 0;
int b = 0;
while (y!=0){
a += y % 10;
y/=10;
}
while (m!=0){
b += m % 10;
m/=10;
}
while (d!=0){
b += d % 10;
d/=10;
}
return a==b ;
}
}
public class 重合次数 {
public static void main(String[] args) {
int h = 6;
int m = 13;
int s = 22;
int ans = 0;
while (true){
if(s == m)ans++;
if(h == 14 && m == 36 && s == 20)break;
s++;
if(s == 60){
s = 0;
m++;
if (m == 60){
m = 0;
h++;
}
}
}
System.out.println(ans - 14 + 6);
}
}
import java.io.*;
import java.util.*;
public class 左移右移 {
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static PrintWriter pr = new PrintWriter(new OutputStreamWriter(System.out));
public static void main(String[] args) throws IOException {
String[] s = br.readLine().trim().split(" ");
int n = Integer.parseInt(s[0]);
int m = Integer.parseInt(s[1]);
Node[] nodes = new Node[n+1];
for (int i = 1; i <= n; i++){
nodes[i] =new Node(i,i);
}
int cnt1 = -1;
int cnt2 = (int) 2e6+1;
for (int i = 0; i < m; i++) {
s = br.readLine().trim().split(" ");
int v = Integer.parseInt(s[1]);
if("L".equals(s[0])){
nodes[v].y = cnt1--;
}
if("R".equals(s[0])){
nodes[v].y = cnt2++;
}
}
Arrays.sort(nodes,1,n+1);
for (int i = 1; i <= n; i++) {
System.out.print(nodes[i].x + " ");
}
}
}
class Node implements Comparable<Node>{
int x;
int y;
public Node(int x,int y){
this.x = x;
this.y = y;
}
@Override
public int compareTo(Node o) {
if (o.y != y)return y - o.y;
return x - o.x;
}
}