1 条题解
-
0
C :
#include<stdio.h> void main(){ int i,n; scanf("%d",&n); for(i=1;i<=n;i++){ if(3*i-2<=n){ printf("%d\n",3*i-2); } } }
C++ :
#include<iostream> using namespace std; int main() { int i,n; cin>>n; for(i = 1;i <= n;i = i + 3){ cout<<i<<endl; } }
Java :
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for(int i=1;i<=n;i=i+3){ System.out.println(i); } } }
Python :
n = int(input()) print(1) a = 1 for i in range(1, n + 1): if i - a == 3: print(i) a += 3
- 1
信息
- ID
- 2615
- 时间
- 1000ms
- 内存
- 16MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者