Submission #1993057
Source Code Expand
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class Main { static InputStream is; static PrintWriter out; static String INPUT = ""; static void solve() { long[][] C = new long[700 + 1][700 + 1]; for (int i = 0; i <= 700; i++) { C[i][0] = 1; for (int j = 1; j <= i; j++) { C[i][j] = C[i - 1][j - 1] + C[i - 1][j]; } } long n = nl(); StringBuilder sb = new StringBuilder(); boolean first = true; for(int i = 650;i >= 0;i--){ long m = n / C[i+7][7]; if(m > 0)first = false; if(first)continue; for(int j = 0;j < m;j++)sb.insert(0, 'L'); n %= C[i+7][7]; sb.insert(0, "FESTIVA"); } out.println(sb); } public static void main(String[] args) throws Exception { long S = System.currentTimeMillis(); is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes()); out = new PrintWriter(System.out); solve(); out.flush(); long G = System.currentTimeMillis(); tr(G-S+"ms"); } private static boolean eof() { if(lenbuf == -1)return true; int lptr = ptrbuf; while(lptr < lenbuf)if(!isSpaceChar(inbuf[lptr++]))return false; try { is.mark(1000); while(true){ int b = is.read(); if(b == -1){ is.reset(); return true; }else if(!isSpaceChar(b)){ is.reset(); return false; } } } catch (IOException e) { return true; } } private static byte[] inbuf = new byte[1024]; static int lenbuf = 0, ptrbuf = 0; private static int readByte() { if(lenbuf == -1)throw new InputMismatchException(); if(ptrbuf >= lenbuf){ ptrbuf = 0; try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); } if(lenbuf <= 0)return -1; } return inbuf[ptrbuf++]; } private static boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); } // private static boolean isSpaceChar(int c) { return !(c >= 32 && c <= 126); } private static int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; } private static double nd() { return Double.parseDouble(ns()); } private static char nc() { return (char)skip(); } private static String ns() { int b = skip(); StringBuilder sb = new StringBuilder(); while(!(isSpaceChar(b))){ sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } private static char[] ns(int n) { char[] buf = new char[n]; int b = skip(), p = 0; while(p < n && !(isSpaceChar(b))){ buf[p++] = (char)b; b = readByte(); } return n == p ? buf : Arrays.copyOf(buf, p); } private static char[][] nm(int n, int m) { char[][] map = new char[n][]; for(int i = 0;i < n;i++)map[i] = ns(m); return map; } private static int[] na(int n) { int[] a = new int[n]; for(int i = 0;i < n;i++)a[i] = ni(); return a; } private static int ni() { int num = 0, b; boolean minus = false; while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')); if(b == '-'){ minus = true; b = readByte(); } while(true){ if(b >= '0' && b <= '9'){ num = num * 10 + (b - '0'); }else{ return minus ? -num : num; } b = readByte(); } } private static long nl() { long num = 0; int b; boolean minus = false; while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')); if(b == '-'){ minus = true; b = readByte(); } while(true){ if(b >= '0' && b <= '9'){ num = num * 10 + (b - '0'); }else{ return minus ? -num : num; } b = readByte(); } } private static void tr(Object... o) { if(INPUT.length() != 0)System.out.println(Arrays.deepToString(o)); } }
Submission Info
Submission Time | |
---|---|
Task | G - FESTIVAL |
User | uwi |
Language | Java8 (OpenJDK 1.8.0) |
Score | 1000 |
Code Size | 3931 Byte |
Status | AC |
Exec Time | 94 ms |
Memory | 27348 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 1000 / 1000 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | example0.txt, example1.txt |
All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, 026.txt, 027.txt, 028.txt, 029.txt, 030.txt, 031.txt, 032.txt, 033.txt, 034.txt, 035.txt, 036.txt, 037.txt, 038.txt, 039.txt, 040.txt, 041.txt, 042.txt, 043.txt, 044.txt, 045.txt, 046.txt, 047.txt, 048.txt, 049.txt, 050.txt, 051.txt, 052.txt, 053.txt, example0.txt, example1.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
000.txt | AC | 88 ms | 23380 KB |
001.txt | AC | 88 ms | 25044 KB |
002.txt | AC | 87 ms | 23508 KB |
003.txt | AC | 87 ms | 24916 KB |
004.txt | AC | 87 ms | 23636 KB |
005.txt | AC | 87 ms | 22612 KB |
006.txt | AC | 88 ms | 23124 KB |
007.txt | AC | 86 ms | 23508 KB |
008.txt | AC | 88 ms | 25300 KB |
009.txt | AC | 85 ms | 25428 KB |
010.txt | AC | 87 ms | 25812 KB |
011.txt | AC | 86 ms | 23764 KB |
012.txt | AC | 85 ms | 23764 KB |
013.txt | AC | 88 ms | 25044 KB |
014.txt | AC | 88 ms | 25044 KB |
015.txt | AC | 89 ms | 23892 KB |
016.txt | AC | 87 ms | 21332 KB |
017.txt | AC | 87 ms | 22868 KB |
018.txt | AC | 87 ms | 22356 KB |
019.txt | AC | 77 ms | 22868 KB |
020.txt | AC | 87 ms | 23124 KB |
021.txt | AC | 79 ms | 25684 KB |
022.txt | AC | 87 ms | 21972 KB |
023.txt | AC | 93 ms | 27348 KB |
024.txt | AC | 82 ms | 25812 KB |
025.txt | AC | 81 ms | 24148 KB |
026.txt | AC | 91 ms | 23252 KB |
027.txt | AC | 91 ms | 22356 KB |
028.txt | AC | 83 ms | 23508 KB |
029.txt | AC | 88 ms | 23636 KB |
030.txt | AC | 91 ms | 25556 KB |
031.txt | AC | 83 ms | 21844 KB |
032.txt | AC | 83 ms | 22228 KB |
033.txt | AC | 89 ms | 23636 KB |
034.txt | AC | 94 ms | 25044 KB |
035.txt | AC | 91 ms | 25556 KB |
036.txt | AC | 88 ms | 23764 KB |
037.txt | AC | 88 ms | 22100 KB |
038.txt | AC | 92 ms | 23508 KB |
039.txt | AC | 88 ms | 25684 KB |
040.txt | AC | 81 ms | 23892 KB |
041.txt | AC | 90 ms | 23380 KB |
042.txt | AC | 89 ms | 23764 KB |
043.txt | AC | 93 ms | 23124 KB |
044.txt | AC | 89 ms | 25684 KB |
045.txt | AC | 90 ms | 21716 KB |
046.txt | AC | 82 ms | 25812 KB |
047.txt | AC | 80 ms | 25684 KB |
048.txt | AC | 92 ms | 25556 KB |
049.txt | AC | 91 ms | 21588 KB |
050.txt | AC | 81 ms | 24020 KB |
051.txt | AC | 89 ms | 25044 KB |
052.txt | AC | 91 ms | 23892 KB |
053.txt | AC | 91 ms | 25940 KB |
example0.txt | AC | 91 ms | 25428 KB |
example1.txt | AC | 79 ms | 23764 KB |