Created
July 14, 2014 12:49
-
-
Save kuuso/fcc4aaba9acdde9deff8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
class TEST{ | |
static void Main(){ | |
Sol mySol =new Sol(); | |
int N=1000; | |
mySol.Solve(N); | |
} | |
} | |
class Sol{ | |
public void Solve(int n){ | |
N=n; | |
//本番間に合わなかったのでコードだけ | |
// こんな感じで足す(横に足すとO(N)) | |
// 6 | |
// 5 | |
// 4 | |
// 3 3 | |
// 2 2 2 | |
// 1 1 1 1 1 1 | |
long cnt=0; | |
for(int i=1;i<=N;i++){ | |
cnt+=i*(N/i); | |
} | |
Console.WriteLine("1 to {0}:{1}",N,cnt); | |
} | |
int N; | |
public Sol(){ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment