And Sn's sum of digit will be n*(n-1)/2
貌似便是如此而已
//By momo #include<cstdio> #include<algorithm> using namespace std; int main(){ int n; scanf("%d", &n); int x = (n / 3); if(n % 3 == 0) printf("%d\n", 2*x); if(n % 3 == 1) printf("%d\n", 2*x); if(n % 3 == 2) printf("%d\n", 2*x+1); }
沒有留言:
張貼留言