Submission #2213568
Source Code Expand
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using static System.Console; using static AtCoder.Util; using static AtCoder.Cin; namespace AtCoder { class Program { static IEnumerable<int> Tribonacchi() { int a, b, c; a = b = 0; c = 1; yield return a; yield return b; yield return c; while(true) { var next = (a + b + c) % 10007; a = b; b = c; c = next; yield return c; } } static void Main() => Tribonacchi().ElementAt(ReadInt() - 1).WriteLine(); } } /* ***************** Following Contents are my common library ******** */ namespace AtCoder { static class Util { public static T debug<T>(this T value) { Console.Error.WriteLine($"debug:{value}"); return value; } public static long ToLong(this String s) => long.Parse(s); public static long ToLong(this char c) => c - '0'; public static int ToInt(this String s) => int.Parse(s); public static int ToInt(this char c) => c - '0'; public static void Times(this int n, Action action) { for (int i = 0; i < n; i++) action(); } public static void Times(this long n, Action action) { for (long i = 0; i < n; i++) action(); } public static void Call<T>(this T t, Action<T> action) => action(t); public static bool In<T>(this T t, IEnumerable<T> range) => range.Contains(t); public static void WriteLine<T>(this T t) => Console.WriteLine(t); public static T Call<S, T>(this S s, Func<S, T> func) => func(s); public static void Each<T>(this IEnumerable<T> e, Action<T> action) { foreach (var v in e) action(v); } public static VectorInt2 ReadVectorInt2() => new VectorInt2(ReadInt(), ReadInt()); public static string ReplaceX(this string input, string pattern, string replace) => Regex.Replace(input, pattern, replace); public static IEnumerable<int> Range(int i, int j) => Enumerable.Range(i, j); } static class Cin { private static Queue<string> tokens; static Cin () { string line; tokens = new Queue<string> (); while ((line = Console.ReadLine ()) != null) { foreach (var token in line.Split (' ')) { tokens.Enqueue (token); } } } static public int ReadInt() => int.Parse(tokens.Dequeue()); static public IEnumerable<int> ReadInt(long n) { for (int i = 0; i < n; i++) yield return ReadInt(); } static public long ReadLong() => long.Parse(tokens.Dequeue()); static public IEnumerable<long> ReadLong(long n) { for (int i = 0; i < n; i++) yield return ReadLong(); } static public string ReadString() => tokens.Dequeue(); } struct VectorInt2 { public int X { get; set; } public int Y { get; set; } public VectorInt2(int x, int y) { X = x; Y = y; } static public VectorInt2 operator+ (VectorInt2 v1, VectorInt2 v2) => new VectorInt2(v1.X + v2.X, v1.Y + v2.Y); static public VectorInt2 operator- (VectorInt2 v1, VectorInt2 v2) => new VectorInt2(v1.X - v2.X, v1.Y - v2.Y); static public VectorInt2 operator* (VectorInt2 v1, VectorInt2 v2) => new VectorInt2(v1.X * v2.X, v1.Y * v2.Y); static public VectorInt2 operator* (VectorInt2 v1, int i) => new VectorInt2(v1.X * i, v1.Y * i); static public VectorInt2 operator* (int i, VectorInt2 v2) => new VectorInt2(i * v2.X, i * v2.Y); static public VectorInt2 operator/ (VectorInt2 v1, int i) => new VectorInt2(v1.X / i, v1.Y / i); } }
Submission Info
Submission Time | |
---|---|
Task | B - トリボナッチ数列 |
User | yuchiki |
Language | C# (Mono 4.6.2.0) |
Score | 100 |
Code Size | 4140 Byte |
Status | AC |
Exec Time | 34 ms |
Memory | 13396 KB |
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 100 / 100 | ||
Status |
|
Set Name | Test Cases |
---|---|
All | sample_01.txt, sample_02.txt, sample_03.txt, test_1.txt, test_1000000.txt, test_1002.txt, test_104.txt, test_107843.txt, test_10980.txt, test_1212.txt, test_1238.txt, test_13194.txt, test_14.txt, test_16.txt, test_2.txt, test_210782.txt, test_21694.txt, test_243.txt, test_24916.txt, test_278.txt, test_3.txt, test_31.txt, test_32.txt, test_42.txt, test_5555.txt, test_567914.txt, test_61868.txt, test_765671.txt, test_8195.txt, test_8353.txt, test_9.txt, test_9625.txt, test_97.txt, test_998.txt, test_999998.txt, test_999999.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 24 ms | 11348 KB |
sample_02.txt | AC | 24 ms | 11348 KB |
sample_03.txt | AC | 25 ms | 11348 KB |
test_1.txt | AC | 24 ms | 13396 KB |
test_1000000.txt | AC | 34 ms | 11348 KB |
test_1002.txt | AC | 24 ms | 11348 KB |
test_104.txt | AC | 23 ms | 11348 KB |
test_107843.txt | AC | 24 ms | 11348 KB |
test_10980.txt | AC | 23 ms | 9300 KB |
test_1212.txt | AC | 23 ms | 9300 KB |
test_1238.txt | AC | 24 ms | 11348 KB |
test_13194.txt | AC | 24 ms | 11348 KB |
test_14.txt | AC | 23 ms | 9300 KB |
test_16.txt | AC | 23 ms | 9300 KB |
test_2.txt | AC | 23 ms | 11348 KB |
test_210782.txt | AC | 26 ms | 13396 KB |
test_21694.txt | AC | 23 ms | 9300 KB |
test_243.txt | AC | 23 ms | 11348 KB |
test_24916.txt | AC | 23 ms | 9300 KB |
test_278.txt | AC | 23 ms | 11348 KB |
test_3.txt | AC | 24 ms | 13396 KB |
test_31.txt | AC | 23 ms | 11348 KB |
test_32.txt | AC | 24 ms | 13396 KB |
test_42.txt | AC | 23 ms | 11348 KB |
test_5555.txt | AC | 23 ms | 11348 KB |
test_567914.txt | AC | 29 ms | 9300 KB |
test_61868.txt | AC | 24 ms | 11348 KB |
test_765671.txt | AC | 32 ms | 11348 KB |
test_8195.txt | AC | 23 ms | 9300 KB |
test_8353.txt | AC | 24 ms | 11348 KB |
test_9.txt | AC | 23 ms | 11348 KB |
test_9625.txt | AC | 23 ms | 11348 KB |
test_97.txt | AC | 23 ms | 11348 KB |
test_998.txt | AC | 23 ms | 9300 KB |
test_999998.txt | AC | 34 ms | 11348 KB |
test_999999.txt | AC | 34 ms | 9300 KB |