#include<iostream>
using namespace std;
int main()
{
int n,x,s=0;
cin>>n; //20
x=1;
while( x<=n )
{
if ( x%3==1 ) s+=x;
++x;
}
cout<<s<<endl;
return 0;
}
/*
输入:20
输出:70
1.用科学计数法表示2600,以下( )是正确的.
A.2.6e+2 B. 2.6e+3
C 2.6e-2 D. 2.6e-3
C D是小于1的正数
*/
python代码:
s=0
n=int(input())
x=1
while x<=n:
if x%3==1:
s+=x
x+=1
print(s)
《小学生C++趣味编程》Scratch、C++
NOI题库 scratch题解(部分)
NOI题库 scratch题解
https://blog.csdn.net/dllglvzhenfeng/category_11603040_2.html
NOI题库 python题解
小学生C++编程启蒙
Scratch -> C++画图->信奥(C++)学习导航
Scratch -> C++画图->信奥(C++)学习导航_dllglvzhenfeng的博客-CSDN博客_c++画图
少儿编程:C++绘图相关书籍篇
Scratch算法相关的书籍
Scratch算法相关的书籍_dllglvzhenfeng的博客-CSDN博客