Skip to content

Instantly share code, notes, and snippets.

@kuuso
Created July 14, 2014 12:49
Show Gist options
  • Save kuuso/fcc4aaba9acdde9deff8 to your computer and use it in GitHub Desktop.
Save kuuso/fcc4aaba9acdde9deff8 to your computer and use it in GitHub Desktop.
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