题意:这样的序列1,12,123,1234,...,12345678910,..问前N个元素和能否被3整除。
Problem:There is sequence 1, 12, 123, 1234, ..., 12345678910, ... . Given first N elements of that sequence. You must determine amount of numbers in it that are divisible by 3.
解法:。。。
Solution:...
#include <iostream>
#include <stdio.h>
using namespace std;
int n,ans;
int main() {
while (~scanf("%d",&n)) {
ans = n/3*2;
if (n%3==2) ans++;
printf("%d\n",ans);
}
return 0;
}