Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Main
- {
- public static void main(String[] args)
- {
- int[] days = new int[367];
- for(int j = 1; j<=5;j++){
- for(int i = j; i <= 366; i+=5){
- switch(j){
- case 1:
- days[i]=1000;
- break;
- case 2:
- days[i]=5000;
- break;
- case 3:
- case 4:
- days[i]=3000;
- break;
- case 5:
- days[i]=-3;
- }
- }
- }
- Scanner input = new Scanner(System.in);
- boolean v = input.nextBoolean();
- int q = input.nextInt();
- int sum =0;
- int[] dayq = new int[q];
- int[] month = new int[q];
- int p = 0;
- int g = 0;
- for(int i = 0; i < q; i++){
- dayq[i] = input.nextInt();
- month[i] = input.nextInt();
- }
- for(int i = 0;i<q;i++){
- sum=0;
- for(int j = 1;j<month[i];j++){
- sum+=GetDaysCount(j,v);
- }
- sum+=dayq[i];
- if(days[sum] < 0){
- g += 3;
- } else {
- p += days[sum];
- }
- }
- System.out.println(p);
- System.out.println(g);
- }
- public static int GetDaysCount(int month, boolean vd){
- switch(month){
- case 1:
- case 3:
- case 5:
- case 7:
- case 8:
- case 10:
- case 12:
- return 31;
- case 4:
- case 6:
- case 9:
- case 11:
- return 30;
- }
- if(vd == true)
- return 29;
- return 28;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement