Skip to content

Instantly share code, notes, and snippets.

@cthbst
Created May 12, 2016 03:37
Show Gist options
  • Save cthbst/6fa5d9cd92ad9248b2209383408c69b6 to your computer and use it in GitHub Desktop.
Save cthbst/6fa5d9cd92ad9248b2209383408c69b6 to your computer and use it in GitHub Desktop.
/**********************************************************************************/
/* Problem: d881 "作業苦多" from CSDC */
/* Language: CPP (334 Bytes) */
/* Result: AC(4ms, 364KB) judge by this@ZeroJudge */
/* Author: cthbst at 2012-02-05 20:04:16 */
/**********************************************************************************/
#include<iostream>
using namespace std;
int main (int argc,char*argv[])
{
int in0 ;
while (cin >>in0 ){
int sum =2 ,ru =1 ;
for (int i=1 ;i<50;i++){
sum += ru, ru = 1+(2+i*in0)*(i+1)/2;
}
cout <<sum <<endl ;
}
return 0 ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment