13 public PrintWriter out
;
17 public IO () throws IOException
{
18 f
= new BufferedReader(new FileReader(name
+ ".in"));
19 out
= new PrintWriter(new BufferedWriter(new FileWriter(name
+ ".out")));
22 public String
nextLine() throws IOException
{
28 public int nextIntLine() throws IOException
{
29 return Integer
.parseInt(nextLine());
32 public void tokenize() {
33 st
= new StringTokenizer(line
);
36 public String
nextToken() {
37 if(st
== null) tokenize();
38 return st
.nextToken();
41 public int nextIntToken() {
42 return Integer
.parseInt(nextToken());
46 out
.close(); // close the output file
47 System
.exit(0); // don't omit this!
51 static boolean debug
= true;
52 static String name
= "friday";
56 public static void main (String
[] args
) throws IOException
{
59 int[] std
= { 3, 0, 3, 2, 3, 2, 3, 3, 2, 3, 2, 3 };
60 int[] leap
= { 3, 1, 3, 2, 3, 2, 3, 3, 2, 3, 2, 3 };
62 int total
= io
.nextIntLine();
64 int[] stat
= { 0, 0, 0, 0, 0, 0, 0 };
68 for(int i
= 0; i
< total
; i
++){
69 int[] off
= (i
% 4 != 0) ? std
: (i
% 100 != 0) ? leap
: (i
% 400 != 100) ? std
: leap
;
71 // System.out.printf("%d %s: %d\n", i, off == leap ? "+" : "-", cur);
73 for(int j
= 0; j
< 12; j
++){
76 cur
= (cur
+ off
[j
]) % 7;
80 for(int i
= 0; i
< 6; i
++){
81 io
.out
.printf("%d ", stat
[i
]);
83 io
.out
.println(stat
[6]);
85 io
.close(); // close the output file