repl.it
@AmirBayramaliev/

CSharpTest

C#

C# experiments

fork
loading
Files
  • main.cs
  • main.exe
main.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System;
using System.Collections.Generic;
using System.Linq;
//using System.IO;
/*
class Log : FileStream {
  private string FilePath = "";

  public Log(string file) {
    //this.FilePath = file;
  }
}
*/

public class Johnann {
    
    public static List<long> John(long n) {
        List<long> katas = new List<long>();
        
        for (int i = 0; i < n; i++) {
            katas.Add(j(n));
        }
        
        return katas;
    }
    private static long j(long n) {
        if (n == 0) return 0;
        return n - a(j(n-1));
    }
    
    public static List<long> Ann(long n) {
        List<long> katas = new List<long>();
        
        for (int i = 0; i < n; i++) {
            katas.Add(a(n));
        }
        return katas;
    }
    private static long a(long n) {
        if (n == 0) return 1;
        return n - j(a(n - 1));
    }
    
    public static long SumJohn(long n) {
        return John(n).AsQueryable().Sum();
    }
    public static long SumAnn(long n) {
        return Ann(n).AsQueryable().Sum();
    }
}

struct Event {
  public string Title;
}

class MainClass {
  public static void Main (string[] args) {
    //Log log = new Log("log.txt");

    foreach(var item in Johnann.John(6))
        Console.WriteLine(item);
  }
}
Fetching token
?