submission_id
stringlengths 10
10
| problem_id
stringlengths 6
6
| language
stringclasses 3
values | code
stringlengths 1
522k
| compiler_output
stringlengths 43
10.2k
|
|---|---|---|---|---|
s845856590
|
p00009
|
Java
|
#include <iostream>
using namespace std;
int main(void){
bool a[600001];
while(!cin.eof()){
int n;
cin >> n;
for(int i = 2; i <= n; i++){
a[i] = true;
}
for(int i = 2; i * i <= n; i++){
if(!a[i]) continue;
for(int j = i + 1; j <= n; j++)
if(!(j % i)){
a[j] = false;
}
}
int ans = 0;
for(int i = 2; i <= n; i++)
if(a[i]){
ans++;
}
cout << ans << endl;
}
return 0;
}
|
Main.java:1: error: illegal character: '#'
#include <iostream>
^
Main.java:1: error: class, interface, enum, or record expected
#include <iostream>
^
Main.java:7: error: not a statement
cin >> n;
^
Main.java:26: error: not a statement
cout << ans << endl;
^
Main.java:3: error: unnamed classes are a preview feature and are disabled by default.
int main(void){
^
(use --enable-preview to enable unnamed classes)
Main.java:3: error: <identifier> expected
int main(void){
^
Main.java:4: error: ']' expected
bool a[600001];
^
7 errors
|
s587388532
|
p00009
|
Java
|
#include<iostream>
#include<stdio.h>
#include<math.h>
int prime(int x)
{
int i,j=1;
int l;
l=sqrt(x);
for(i=2;i<=l+1;i++)
{
if(x%i==0)
{
j=0;
break;
}
}
//if(j==0)return 0;
if(x==2||j==1) return 1;
}
using namespace std;
int main()
{
int n;//=999999;
//cout<<n<<endl;
int j,i;int s=0;
while(cin>>n)
{
s=0;
for(i=2;i<=n;i++)
{
if(prime(i)==1){s++;}//cout<<i<<endl;}
}
cout<<s<<endl;
}
return 0;
}
|
Main.java:1: error: illegal character: '#'
#include<iostream>
^
Main.java:2: error: illegal character: '#'
#include<stdio.h>
^
Main.java:3: error: illegal character: '#'
#include<math.h>
^
Main.java:7: error: unnamed classes are a preview feature and are disabled by default.
int l;
^
(use --enable-preview to enable unnamed classes)
Main.java:8: error: class, interface, enum, or record expected
l=sqrt(x);
^
Main.java:9: error: class, interface, enum, or record expected
for(i=2;i<=l+1;i++)
^
Main.java:9: error: class, interface, enum, or record expected
for(i=2;i<=l+1;i++)
^
Main.java:9: error: class, interface, enum, or record expected
for(i=2;i<=l+1;i++)
^
Main.java:14: error: class, interface, enum, or record expected
break;
^
Main.java:16: error: class, interface, enum, or record expected
}
^
Main.java:22: error: class, interface, enum, or record expected
}
^
Main.java:37: error: not a statement
cout<<s<<endl;
^
12 errors
|
s455112144
|
p00009
|
Java
|
import java.util.Scanner;
import java.util.HashSet;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
while (scan.hasNext()) {
int n = scan.nextInt();
HashSet<int> set = new HashSet<int>;
for (int i = 2; i < n; i++) {
set.add(i);
}
for (int i = 2; i < n; i++) {
if (!set.contains(i)) continue;
for (int j = i * 2; j < n; j += i) {
set.remove(j);
}
}
System.out.println(set.size());
}
}
}
|
Main.java:10: error: '(' or '[' expected
HashSet<int> set = new HashSet<int>;
^
1 error
|
s509846288
|
p00009
|
Java
|
import java.util.Scanner;
import java.util.HashSet;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
while (scan.hasNext()) {
int n = scan.nextInt();
HashSet<int> set = new HashSet<int>();
for (int i = 2; i < n; i++) {
set.add(i);
}
for (int i = 2; i < n; i++) {
if (!set.contains(i)) continue;
for (int j = i * 2; j < n; j += i) {
set.remove(j);
}
}
System.out.println(set.size());
}
}
}
|
Main.java:10: error: unexpected type
HashSet<int> set = new HashSet<int>();
^
required: reference
found: int
Main.java:10: error: unexpected type
HashSet<int> set = new HashSet<int>();
^
required: reference
found: int
2 errors
|
s522100309
|
p00009
|
Java
|
import java.util.Scanner;
import java.util.HashSet;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
while (scan.hasNext()) {
int n = scan.nextInt();
boolean[] isPrime = new boolean[n + 1];
for (int i = 2; i <= n; i++) {
isPrime[i] = true
}
for (int i = 2; i <= n; i++) {
if (!isPrime[i]) continue;
for (int j = i * 2; j <= n; j += i) {
isPrime[i] = false;
}
}
int count = 0;
for (int i = 2; i <= n; i++) {
if (isPrime[i]) count++;
}
System.out.println(count);
}
}
}
|
Main.java:12: error: ';' expected
isPrime[i] = true
^
1 error
|
s749022992
|
p00009
|
Java
|
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String args[] ) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while(true){
String num=br.readLine();
if(num==null){
break;
}
int n = Integer.parseInt(num);
boolean check=true;
for(int m=2;m<n-1;m++){
if(n%m==0){
check=false;
break;
}
}
if(check==true){
System.out.println(n);
}
}
}
return 0;
}
}
}
|
Main.java:24: error: illegal start of type
return 0;
^
Main.java:26: error: class, interface, enum, or record expected
}
^
2 errors
|
s015461612
|
p00009
|
Java
|
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String args[] ) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while(true){
String num=br.readLine();
if(num==null){
break;
}
int n = Integer.parseInt(num);
boolean check=true;
for(int m=2;m<n-1;m++){
if(n%m==0){
check=false;
break;
}
}
if(check==true){
System.out.println(n);
}
}
}
}
}
}
|
Main.java:25: error: class, interface, enum, or record expected
}
^
1 error
|
s102585930
|
p00009
|
Java
|
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String args[] ) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while(true){
String num=br.readLine();
if(num==null){
break;
}
int n = Integer.parseInt(num);
boolean check=true;
for(int m=2;m<n-1;m++){
if(n%m==0){
check=false;
break;
}
}
if(check==true){
System.out.println(n);
}
}
}
}
}
|
Main.java:25: error: class, interface, enum, or record expected
}
^
1 error
|
s270460665
|
p00009
|
Java
|
import java.util.Scanner;
public class Main09{
public static void main(String[] args){
while(true){
Scanner in = new Scanner(System.in);
String x = in.nextLine();
int a = Integer.parseInt(x);
int n =0;
int[] p = new int[(a+1)];
int[] q = new int[(a+1)];
for(int i =1;i<=a;i++){
for(int j=1;j<i;j++){
if(i%j == 0){
p[i] += 1;
}else{
q[i] += 1;
}
}
}
for(int i =1;i<=a;i++){
if(p[i] == 1){
n += 1;
}
}
System.out.println(n);
}
}
}
|
Main.java:3: error: class Main09 is public, should be declared in a file named Main09.java
public class Main09{
^
1 error
|
s989609209
|
p00009
|
Java
|
public class Main{
public static void main(String[] args){
while(true){
Scanner in = new Scanner(System.in);
String x = in.nextLine();
int a = Integer.parseInt(x);
int n =0;
int[] p = new int[(a+1)];
int[] q = new int[(a+1)];
for(int i =1;i<=a;i++){
for(int j=1;j<i;j++){
if(i%j == 0){
p[i] += 1;
}else{
q[i] += 1;
}
}
}
for(int i =1;i<=a;i++){
if(p[i] == 1){
n += 1;
}
}
System.out.println(n);
}
}
}
|
Main.java:4: error: cannot find symbol
Scanner in = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:4: error: cannot find symbol
Scanner in = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 errors
|
s951973261
|
p00009
|
Java
|
import java.io.*;
public class Main09 {
public static void main(String[] args){
BufferedReader reader =new BufferedReader(new InputStreamReader(System.in));
String line;
try{
while((line=reader.readLine()) != null){
int x =Integer.parseInt(line);
int[] p=new int[x+1];
int[] q=new int[x+1];
int n=0;
for(int i =0;i<=x;i++){
for(int j =1;j<=i;j++){
if(i%j ==0){
p[i] += 1;
}else{
q[i] += 1;
}
}
}
for(int i = 1;i<=x;i++){
if(p[i] == 2){
n += 1;
}
}
System.out.println(n);
}
}catch(IOException e){
System.out.println(e);
System.exit(0);
}catch(NumberFormatException e){
System.exit(0);
}
}
}
|
Main.java:3: error: class Main09 is public, should be declared in a file named Main09.java
public class Main09 {
^
1 error
|
s166510757
|
p00009
|
Java
|
import java.io.*;
public class Main {
public static void main(String[] args){
BufferedReader reader =new BufferedReader(new InputStreamReader(System.in));
String line;
try{
while((line=reader.readLine()) != null){
int x =Integer.parseInt(line);
int[] p=new int[x+1];
int[] q=new int[x+1];
int n=0;
for(int i =0;i<=x;i++){
for(int j =1;j<=i;j++){
if(i%j ==0){
p[i] += 1;
}else{
q[i] += 1;
}
}
}
for(int i = 1;i<=x;i++){
if(p[i] == 2){
n += 1;
}
}
System.out.println(n);
}
return 0;
}catch(IOException e){
System.out.println(e);
System.exit(0);
}catch(NumberFormatException e){
System.exit(0);
}
}
}
|
Main.java:29: error: incompatible types: unexpected return value
return 0;
^
1 error
|
s671961849
|
p00009
|
Java
|
import java.io.*;
public class Niam {
public static void main(String[] args){
try{
BufferedReader reader =new BufferedReader(new InputStreamReader(System.in));
String line;
while((line=reader.readLine()) != null){
int x =Integer.parseInt(line);
int[] p=new int[x+1];
int n=0;
for(int i =0;i<=x;i++){
for(int j =1;j<=i;j++){
if(i%j ==0){
p[i] += 1;
}
}
if(p[i] == 2){
n += 1;
}
}
System.out.println(n);
}
reader.close();
}catch(IOException e){
System.out.println(e);
System.exit(0);
}catch(NumberFormatException e){
System.exit(0);
}
}
}
|
Main.java:3: error: class Niam is public, should be declared in a file named Niam.java
public class Niam {
^
1 error
|
s228112939
|
p00009
|
C
|
#include<stdio.h>
#include<math.h>
#include<stdbool.h>
static int count = 1;
static int prime[5000] = {2,3};
static bool primebool[5000] = {true,true};
int primesearch(int);
void primecount(int,int);
void reset();
int main(){
int n;
while(scanf("%d", &n) != EOF){
if (n>1){
primecount(0,n);
printf("%d\n", count);
reset();
}
else{
printf("0\n");
}
}
return 0;
}
void primecount(int i,int n){
if (!primebool[i]){
prime[i] = primesearch(prime[i-1]+2);
primebool[i] = true;
}
if (prime[i]<=n){
count++;
primecount(i+1,n);
}
}
int primesearch(int x){
int i,sq;
sq = (int)sqrt(x);
for(i=3;i<=sq;i=i+2){
if(x%i==0){
return primesearch(x+2);
}
}
return x;
}
|
/usr/bin/ld: /tmp/ccywatTb.o: in function `main':
main.c:(.text+0x43): undefined reference to `reset'
/usr/bin/ld: /tmp/ccywatTb.o: in function `primesearch':
main.c:(.text+0x14f): undefined reference to `sqrt'
collect2: error: ld returned 1 exit status
|
s172848883
|
p00009
|
C
|
include<stdio.h>
#include<math.h>
#include<stdbool.h>
static int count = 1;
bool primebool(int);
void primecount(int,int);
void reset();
int main(){
int n;
while(scanf("%d", &n) != EOF){
if (n>2){
primecount(3,n);
printf("%d\n", count);
reset();
}
else if (n==2){
printf("1\n");
}
else{
printf("0\n");
}
}
return 0;
}
void primecount(int i, int n){
if (i<=n){
if(primebool(i)){
count++;
}
primecount(i+2,n);
}
}
bool primebool(int x){
int i,sq;
sq = (int)sqrt(x);
for(i=3;i<=sq;i=i+2){
if(x%i==0){
return false;
}
}
return true;
}
void reset(){
count = 1;
}
|
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
1 | include<stdio.h>
| ^
main.c: In function 'main':
main.c:13:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
13 | while(scanf("%d", &n) != EOF){
| ^~~~~
main.c:4:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
3 | #include<stdbool.h>
+++ |+#include <stdio.h>
4 |
main.c:13:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
13 | while(scanf("%d", &n) != EOF){
| ^~~~~
main.c:13:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:13:28: error: 'EOF' undeclared (first use in this function)
13 | while(scanf("%d", &n) != EOF){
| ^~~
main.c:13:28: note: 'EOF' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
main.c:13:28: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:7: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
16 | printf("%d\n", count);
| ^~~~~~
main.c:16:7: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:16:7: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:16:7: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:20:7: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
20 | printf("1\n");
| ^~~~~~
main.c:20:7: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:23:7: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
23 | printf("0\n");
| ^~~~~~
main.c:23:7: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s408717032
|
p00009
|
C
|
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main() {
while (true) {
int n, ans = 0;
scanf("%d", &n);
if (n >= 2)ans++;
for (int i = 3; i <= n; i += 2) {
int h = 1;
for (int j = 3; j*j <= i&&h==1; j += 2) {
if (i%j == 0)h = 0;
}
ans += h;
}
printf("%d\n", ans);
}
}
|
main.c: In function 'main':
main.c:5:16: error: 'true' undeclared (first use in this function)
5 | while (true) {
| ^~~~
main.c:3:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
2 | #include<stdio.h>
+++ |+#include <stdbool.h>
3 |
main.c:5:16: note: each undeclared identifier is reported only once for each function it appears in
5 | while (true) {
| ^~~~
|
s586372384
|
p00009
|
C
|
#include<stdio.h>
int main() {
while (true) {
int n, ans = 0;
scanf("%d", &n);
if (n >= 2)ans++;
for (int i = 3; i <= n; i += 2) {
int h = 1;
for (int j = 3; j*j <= i&&h==1; j += 2) {
if (i%j == 0)h = 0;
}
ans += h;
}
printf("%d\n", ans);
}
}
|
main.c: In function 'main':
main.c:5:16: error: 'true' undeclared (first use in this function)
5 | while (true) {
| ^~~~
main.c:3:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
2 | #include<stdio.h>
+++ |+#include <stdbool.h>
3 |
main.c:5:16: note: each undeclared identifier is reported only once for each function it appears in
5 | while (true) {
| ^~~~
|
s089627957
|
p00009
|
C
|
include<stdio.h>
|
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
1 | include<stdio.h>
| ^
|
s899825983
|
p00009
|
C
|
#include <stdio.h>
#include <math.h>
int main(){
while(1){
int n,i,cnt=0,sw=1,sosuu[100000],t;
if(scanf("%d",&n)==EOF) break;
if(n<=1){
cnt=0;
}else{
sosuu[cnt]=2;
cnt++;
for(i=3;i<=n;i+=2){
sw=1;
for(t=0;t<cnt&&sosuu[t]*sosuu[t]<=i;t++){
if(i%sosuu[t]==0){
sw=0;
break;
}
}
if(sw==1){
sosuu[cnt]=i;
cnt++;
}
}
}
printf("%d\n",cnt);
}
return 0;
}
|
main.c: In function 'main':
main.c:6:1: error: stray '\302' in program
6 | <U+00A0><U+00A0><U+00A0><U+00A0>while(1){
| ^~~~~~~~
main.c:6:2: error: stray '\302' in program
6 | <U+00A0><U+00A0><U+00A0><U+00A0>while(1){
| ^~~~~~~~
main.c:6:3: error: stray '\302' in program
6 | <U+00A0><U+00A0><U+00A0><U+00A0>while(1){
| ^~~~~~~~
main.c:6:4: error: stray '\302' in program
6 | <U+00A0><U+00A0><U+00A0><U+00A0>while(1){
| ^~~~~~~~
main.c:7:1: error: stray '\302' in program
7 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>int n,i,cnt=0,sw=1,sosuu[100000],t;
| ^~~~~~~~
main.c:7:2: error: stray '\302' in program
7 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>int n,i,cnt=0,sw=1,sosuu[100000],t;
| ^~~~~~~~
main.c:7:3: error: stray '\302' in program
7 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>int n,i,cnt=0,sw=1,sosuu[100000],t;
| ^~~~~~~~
main.c:7:4: error: stray '\302' in program
7 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>int n,i,cnt=0,sw=1,sosuu[100000],t;
| ^~~~~~~~
main.c:7:5: error: stray '\302' in program
7 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>int n,i,cnt=0,sw=1,sosuu[100000],t;
| ^~~~~~~~
main.c:7:6: error: stray '\302' in program
7 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>int n,i,cnt=0,sw=1,sosuu[100000],t;
| ^~~~~~~~
main.c:7:7: error: stray '\302' in program
7 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>int n,i,cnt=0,sw=1,sosuu[100000],t;
| ^~~~~~~~
main.c:7:8: error: stray '\302' in program
7 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>int n,i,cnt=0,sw=1,sosuu[100000],t;
| ^~~~~~~~
main.c:8:1: error: stray '\302' in program
8 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>if(scanf("%d",&n)==EOF) break;
| ^~~~~~~~
main.c:8:2: error: stray '\302' in program
8 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>if(scanf("%d",&n)==EOF) break;
| ^~~~~~~~
main.c:8:3: error: stray '\302' in program
8 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>if(scanf("%d",&n)==EOF) break;
| ^~~~~~~~
main.c:8:4: error: stray '\302' in program
8 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>if(scanf("%d",&n)==EOF) break;
| ^~~~~~~~
main.c:8:5: error: stray '\302' in program
8 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>if(scanf("%d",&n)==EOF) break;
| ^~~~~~~~
main.c:8:6: error: stray '\302' in program
8 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>if(scanf("%d",&n)==EOF) break;
| ^~~~~~~~
main.c:8:7: error: stray '\302' in program
8 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>if(scanf("%d",&n)==EOF) break;
| ^~~~~~~~
main.c:8:8: error: stray '\302' in program
8 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>if(scanf("%d",&n)==EOF) break;
| ^~~~~~~~
main.c:9:1: error: stray '\302' in program
9 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>if(n<=1){
| ^~~~~~~~
main.c:9:2: error: stray '\302' in program
9 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>if(n<=1){
| ^~~~~~~~
main.c:9:3: error: stray '\302' in program
9 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>if(n<=1){
| ^~~~~~~~
main.c:9:4: error: stray '\302' in program
9 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>if(n<=1){
| ^~~~~~~~
main.c:9:5: error: stray '\302' in program
9 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>if(n<=1){
| ^~~~~~~~
main.c:9:6: error: stray '\302' in program
9 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>if(n<=1){
| ^~~~~~~~
main.c:9:7: error: stray '\302' in program
9 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>if(n<=1){
| ^~~~~~~~
main.c:9:8: error: stray '\302' in program
9 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>if(n<=1){
| ^~~~~~~~
main.c:10:1: error: stray '\302' in program
10 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>cnt=0;
| ^~~~~~~~
main.c:10:2: error: stray '\302' in program
10 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>cnt=0;
| ^~~~~~~~
main.c:10:3: error: stray '\302' in program
10 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>cnt=0;
| ^~~~~~~~
main.c:10:4: error: stray '\302' in program
10 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>cnt=0;
| ^~~~~~~~
main.c:10:5: error: stray '\302' in program
10 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>cnt=0;
| ^~~~~~~~
main.c:10:6: error: stray '\302' in program
10 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>cnt=0;
| ^~~~~~~~
main.c:10:7: error: stray '\302' in program
10 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>cnt=0;
| ^~~~~~~~
main.c:10:8: error: stray '\302' in program
10 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>cnt=0;
| ^~~~~~~~
main.c:10:9: error: stray '\302' in program
10 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>cnt=0;
| ^~~~~~~~
main.c:10:10: error: stray '\302' in program
10 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>cnt=0;
| ^~~~~~~~
main.c:10:11: error: stray '\302' in program
10 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>cnt=0;
| ^~~~~~~~
main.c:10:12: error: stray '\302' in program
10 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>cnt=0;
| ^~~~~~~~
main.c:11:1: error: stray '\302' in program
11 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>}else{
| ^~~~~~~~
main.c:11:2: error: stray '\302' in program
11 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>}else{
| ^~~~~~~~
main.c:11:3: error: stray '\302' in program
11 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>}else{
| ^~~~~~~~
main.c:11:4: error: stray '\302' in program
11 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>}else{
| ^~~~~~~~
main.c:11:5: error: stray '\302' in program
11 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>}else{
| ^~~~~~~~
main.c:11:6: error: stray '\302' in program
11 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>}else{
| ^~~~~~~~
main.c:11:7: error: stray '\302' in program
11 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>}else{
| ^~~~~~~~
main.c:11:8: error: stray '\302' in program
11 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>}else{
| ^~~~~~~~
main.c:12:1: error: stray '\302' in program
12 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>sosuu[cnt]=2;
| ^~~~~~~~
main.c:12:2: error: stray '\302' in program
12 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>sosuu[cnt]=2;
| ^~~~~~~~
main.c:12:3: error: stray '\302' in program
12 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>sosuu[cnt]=2;
| ^~~~~~~~
main.c:12:4: error: stray '\302' in program
12 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>sosuu[cnt]=2;
| ^~~~~~~~
main.c:12:5: error: stray '\302' in program
12 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>sosuu[cnt]=2;
| ^~~~~~~~
main.c:12:6: error: stray '\302' in program
12 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0>sosuu[cnt]=2;
| ^~~~~~~~
main.c:12:7: error: stray '\302' in program
12 | <U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+00A0><U+0
|
s647359231
|
p00009
|
C
|
#include<stdio.h>
int Isprime(int n);
int main(){
int n,i,cnt,times;
times=0;
while((scanf("%d\n",&n)!=EOF)||times<30){
cnt=0;
for(i=1;i<=n;i++){
cnt+=Isprime(i);
}
printf("%d\n",cnt);
times++;
}
int Isprime(int n){
int i,isp;
isp=1;
if(n==1){
isp=0;
}
for(i=2;i<n;i++){
if(n%i==0){
isp=0;
}
}
return isp;
}
|
main.c: In function 'main':
main.c:30:1: error: expected declaration or statement at end of input
30 | }
| ^
|
s717079400
|
p00009
|
C
|
#include<stdio.h>
int Isprime(int n);
int main(){
int n,i,cnt,times;
times=0;
while((scanf("\n%d",&n)!=EOF)||(times<30)){
cnt=0;
for(i=1;i<=n;i++){
cnt+=Isprime(i);
}
printf("%d\n",cnt);
times++;
}
int Isprime(int n){
int i,isp;
isp=1;
if(n==1){
isp=0;
}
for(i=2;i<n;i++){
if(n%i==0){
isp=0;
}
}
return isp;
}
|
main.c: In function 'main':
main.c:30:1: error: expected declaration or statement at end of input
30 | }
| ^
|
s717785955
|
p00009
|
C
|
#include<stdio.h>
int Isprime(int n);
int main(){
int n,i,cnt,times;
times=0;
while((scanf("\n%d",&n)!=EOF)||(times<30)){
cnt=0;
for(i=1;i<=n;i++){
cnt+=Isprime(i);
}
printf("%d\n",cnt);
times++;
}
return 0;
}
int Isprime(int n){
int i,isp;
int prime[167];
prime[167]={2, 3, 4, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997};
isp=1;
if((n==1)||){
isp=0;
}
for(i=0;i=<167;i++){
if(n%prime[i]==0){
isp=0;
break;
}
}
return isp;
}
|
main.c: In function 'Isprime':
main.c:23:12: error: expected expression before '{' token
23 | prime[167]={2, 3, 4, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997};
| ^
main.c:25:12: error: expected expression before ')' token
25 | if((n==1)||){
| ^
main.c:28:11: error: expected expression before '<' token
28 | for(i=0;i=<167;i++){
| ^
|
s703195533
|
p00009
|
C
|
#include<stdio.h>
int Isprime(int n);
int main(){
int n,i,cnt,times;
int prime[167];
prime[167]={2, 3, 4, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997};
times=0;
while((scanf("\n%d",&n)!=EOF)||(times<30)){
cnt=0;
for(i=0;i<=167;i++){
if((n<prime[i])&&(cnt==0)){
cnt=i;
}
}
printf("%d\n",cnt);
times++;
}
return 0;
}
|
main.c: In function 'main':
main.c:8:12: error: expected expression before '{' token
8 | prime[167]={2, 3, 4, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997};
| ^
|
s613311476
|
p00009
|
C
|
#include<stdio.h>
int Isprime(int n);
int main(){
int n,i,cnt,times;
int prime[167];
prime={2, 3, 4, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997};
times=0;
while((scanf("\n%d",&n)!=EOF)||(times<30)){
cnt=0;
for(i=0;i<=167;i++){
if((n<prime[i])&&(cnt==0)){
cnt=i;
}
}
printf("%d\n",cnt);
times++;
}
return 0;
}
|
main.c: In function 'main':
main.c:8:7: error: expected expression before '{' token
8 | prime={2, 3, 4, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997};
| ^
|
s015572792
|
p00009
|
C
|
#include<stdio.h>
int Isprime(int n);
int main(){
int n,i,cnt,times;
int prime[168];
prime={2, 3, 4, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997};
times=0;
while((scanf("\n%d",&n)!=EOF)||(times<30)){
cnt=0;
for(i=0;i<=167;i++){
if((n<prime[i])&&(cnt==0)){
cnt=i;
}
}
printf("%d\n",cnt);
times++;
}
return 0;
}
|
main.c: In function 'main':
main.c:8:7: error: expected expression before '{' token
8 | prime={2, 3, 4, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997};
| ^
|
s094547023
|
p00009
|
C
|
int main () {
int a,b=9,c=9,d=9,e=9,f=0,g=1000,h;
int kaisu[1000];
for(g=0;g<1000;g++){kaisu[g]=1;}
while(scanf("%d",&a)!=EOF){
if(a==1)kaisu[f]--;
for(b=3;b<=a;b+=2){
/*for(c=2;c<b;c++){
// printf("%d",c);
if(b%c==0){ break;}
}
if(c>=b){
kaisu[f]++;
}
*/
if(IsPrime(b)==1)kaisu[f]++;
}
f++;
}
for(h=0;h<f;h++){
printf("%d\n",kaisu[h]);
}
//scanf("%d",&a);
return 0;
}
int IsPrime(int n){
int i;
if(n < 2)
return 0;
else if(n == 2)
return 1;
if(n % 2 == 0)
return 0;
for(i = 3; i <= n / i; i += 2)
if(n % i == 0)
return 0;
return 1;
}
|
main.c: In function 'main':
main.c:7:15: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
7 | while(scanf("%d",&a)!=EOF){
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | int main () {
main.c:7:15: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
7 | while(scanf("%d",&a)!=EOF){
| ^~~~~
main.c:7:15: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:7:31: error: 'EOF' undeclared (first use in this function)
7 | while(scanf("%d",&a)!=EOF){
| ^~~
main.c:7:31: note: 'EOF' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
main.c:7:31: note: each undeclared identifier is reported only once for each function it appears in
main.c:20:28: error: implicit declaration of function 'IsPrime' [-Wimplicit-function-declaration]
20 | if(IsPrime(b)==1)kaisu[f]++;
| ^~~~~~~
main.c:27:17: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
27 | printf("%d\n",kaisu[h]);
| ^~~~~~
main.c:27:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:27:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:27:17: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s091532837
|
p00009
|
C
|
#include <cstdio>
#include <vector>
using namespace std;
int main()
{
int n;
while (scanf("%d", &n) != EOF){
vector<int> prime;
if (n >= 2){
prime.push_back(2);
}
for (int i = 3; i <= n; i++){
int j;
for (j = 0; j < prime.size(); j++){
if (i % prime[j] == 0){
break;
}
}
if (j == prime.size()){
prime.push_back(i);
}
}
printf("%d\n", prime.size());
}
return 0;
}
|
main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s865322882
|
p00009
|
C
|
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
int main(){
int j,s[1000000]=0;
long i,n,d=0;
for(i=3;i<1000000;i++){
for(j=2;j*j<i;j+=2){
if(j%i==0){
d--;
break;
}
if(j==2)
j=1;
}
s[i] = ++d;
}
while(EOF != scanf("%d",&n)){
printf("%d\n",&d);
}
return 0;
}
|
main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s276897046
|
p00009
|
C
|
#include <stdio.h>
int z[30],count[30];
int main(void)
{
int i,j,n=0,k;
for (i=0; z[i] != ; i++){
scanf("%d", &z[i]);
n++;
}
printf("nの個数%d\n", n);
for (n -= 1; n>=0; n--){
for (i=2; i*i<=z[n]; i++){
if (z[n]%i != 0){
count[n]++;
}
}
printf("%d\n", count[n]);
}
return 0;
}
|
main.c: In function 'main':
main.c:8:27: error: expected expression before ';' token
8 | for (i=0; z[i] != ; i++){
| ^
|
s649915150
|
p00009
|
C
|
#include<stdio.h>
#include<math.h>
#define N 1000000
bool is_prime[N];
int sieve(int n){
int p=0;
for(int i=0;i<=n;i++)
is_prime[i]=true;
is_prime[0]=is_prime[1]=false;
for(int i=0;i<=n;i++){
if(is_prime[i]){
p++;
for(int j=i*2;j<=n;j=j+i){
is_prime[j]=false;
}
}
}
return p;
}
int main()
{
int n;
while(scanf("%d",&n)!=EOF){
printf("%d\n",sieve(n));
}
}
|
main.c:5:1: error: unknown type name 'bool'
5 | bool is_prime[N];
| ^~~~
main.c:3:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
2 | #include<math.h>
+++ |+#include <stdbool.h>
3 | #define N 1000000
main.c: In function 'sieve':
main.c:11:24: error: 'true' undeclared (first use in this function)
11 | is_prime[i]=true;
| ^~~~
main.c:11:24: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:11:24: note: each undeclared identifier is reported only once for each function it appears in
main.c:12:33: error: 'false' undeclared (first use in this function)
12 | is_prime[0]=is_prime[1]=false;
| ^~~~~
main.c:12:33: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
|
s032197538
|
p00009
|
C
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
int i;
int* check = (int*) malloc(sizeof(int)*10);
for (i=0; i<999999; i++)
{
int num, j, count = 0;
scanf("%d", &num);
check = (int*) realloc(sizeof(int)*10);
int k;
for (k=0; k<num; k++)
{
check[k] = k;
}
for (j=2; j<sqrt(num); j++)
{
if (check[j] == 0)
continue;
int l;
for (l=2; l * j < num; l++)
{
check[l * j] = 0;
}
}
for (j=2; j<num; j++)
{
if (check[j] != 0)
printf("%d\n", j);
}
printf("%d\n", count);
}
free(check);
return 0;
}
|
main.c: In function 'main':
main.c:14:32: error: passing argument 1 of 'realloc' makes pointer from integer without a cast [-Wint-conversion]
14 | check = (int*) realloc(sizeof(int)*10);
| ^~~~~~~~~~~~~~
| |
| long unsigned int
In file included from main.c:2:
/usr/include/stdlib.h:683:29: note: expected 'void *' but argument is of type 'long unsigned int'
683 | extern void *realloc (void *__ptr, size_t __size)
| ~~~~~~^~~~~
main.c:14:24: error: too few arguments to function 'realloc'
14 | check = (int*) realloc(sizeof(int)*10);
| ^~~~~~~
/usr/include/stdlib.h:683:14: note: declared here
683 | extern void *realloc (void *__ptr, size_t __size)
| ^~~~~~~
|
s382612718
|
p00009
|
C
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
int i;
int* check = (int*) malloc(sizeof(int)*10);
for (i=0; i<999999; i++)
{
int num, j, count = 0;
scanf("%d", &num);
check = (int*) realloc(sizeof(int)*10);
int k;
for (k=0; k<num; k++)
{
check[k] = k;
}
for (j=2; j<sqrt(num); j++)
{
if (check[j] == 0)
continue;
int l;
for (l=2; l * j < num; l++)
{
check[l * j] = 0;
}
}
for (j=2; j<num; j++)
{
if (check[j] != 0)
count++;
}
printf("%d\n", count);
}
free(check);
return 0;
}
|
main.c: In function 'main':
main.c:14:32: error: passing argument 1 of 'realloc' makes pointer from integer without a cast [-Wint-conversion]
14 | check = (int*) realloc(sizeof(int)*10);
| ^~~~~~~~~~~~~~
| |
| long unsigned int
In file included from main.c:2:
/usr/include/stdlib.h:683:29: note: expected 'void *' but argument is of type 'long unsigned int'
683 | extern void *realloc (void *__ptr, size_t __size)
| ~~~~~~^~~~~
main.c:14:24: error: too few arguments to function 'realloc'
14 | check = (int*) realloc(sizeof(int)*10);
| ^~~~~~~
/usr/include/stdlib.h:683:14: note: declared here
683 | extern void *realloc (void *__ptr, size_t __size)
| ^~~~~~~
|
s754565273
|
p00009
|
C
|
int main(){
int num;
int ans=0;
int i,j,k;
int box[100000];
while(scanf("%d",&num)!=EOF){
for(i=0;i<num;i++){
for(j=0;j<num;j++)box[i]=1;
}
for(i=2;i<sqrt(num);i++){
if(box[i]==1){
for(j=2;i*j<num;j++){
box[i*j]=0;
}
}
}
for(i=0;i<num;i++)if(box[i]==1)ans++;
printf("%d\n",ans);
ans=0;
}
return 0;
}
|
main.c: In function 'main':
main.c:7:15: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
7 | while(scanf("%d",&num)!=EOF){
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | int main(){
main.c:7:15: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
7 | while(scanf("%d",&num)!=EOF){
| ^~~~~
main.c:7:15: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:7:33: error: 'EOF' undeclared (first use in this function)
7 | while(scanf("%d",&num)!=EOF){
| ^~~
main.c:7:33: note: 'EOF' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
main.c:7:33: note: each undeclared identifier is reported only once for each function it appears in
main.c:13:27: error: implicit declaration of function 'sqrt' [-Wimplicit-function-declaration]
13 | for(i=2;i<sqrt(num);i++){
| ^~~~
main.c:1:1: note: include '<math.h>' or provide a declaration of 'sqrt'
+++ |+#include <math.h>
1 | int main(){
main.c:13:27: warning: incompatible implicit declaration of built-in function 'sqrt' [-Wbuiltin-declaration-mismatch]
13 | for(i=2;i<sqrt(num);i++){
| ^~~~
main.c:13:27: note: include '<math.h>' or provide a declaration of 'sqrt'
main.c:21:17: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
21 | printf("%d\n",ans);
| ^~~~~~
main.c:21:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:21:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:21:17: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s700986942
|
p00009
|
C
|
#include<stdio.h>
int main(){
int i,j,total,n;
while(scanf("%d",&n)!=0){
total=n-1;
for(i=2;i<=n;i++){
for(j=2;j<i;j++){
if(i%j==0){
total--;
break;
}
}
}
printf("%d\n"total);
}
return(0);
}
|
main.c: In function 'main':
main.c:14:18: error: expected ')' before 'total'
14 | printf("%d\n"total);
| ~ ^~~~~
| )
|
s379127216
|
p00009
|
C
|
#include<stdio.h>
int main(void){
int i,n,j,count=0;
while((scanf("%d",&n))!=EOF){
for(i=0;i<=n;i++){
for(j=0;j<i;j++){
if(i%j==0){
coount++;
break;
}
}
}
count=n-count;
printf("%d",count);
count=0;
}
return 0;
}
|
main.c: In function 'main':
main.c:9:1: error: 'coount' undeclared (first use in this function); did you mean 'count'?
9 | coount++;
| ^~~~~~
| count
main.c:9:1: note: each undeclared identifier is reported only once for each function it appears in
|
s948043446
|
p00009
|
C
|
#include<stdio.h>
int main (void)
{
int n,i,count,t,prime,l;
for(l=0;l<30;l++ ){
scanf("%d",&n);
1
prime = 0;
for(t=1;t<=n;t++){
count= 0;
for(i=1;i<=t;i++){
if(t%i == 0){
count += 1;
}else{
;
}
}
if(count == 2){
prime += 1;
}else{
;
}
}
printf("%d\n",prime);
}
return 0;
}
|
main.c: In function 'main':
main.c:8:10: error: expected ';' before 'prime'
8 | 1
| ^
| ;
9 |
10 | prime = 0;
| ~~~~~
|
s835897726
|
p00009
|
C
|
#include<stdio.h>
int main (void)
{
int n,i,count,t,prime,l;
for(l=0;l<30;l++ ){
scanf("%d",&n);
1
prime = 0;
for(t=1;t<=n;t++){
count= 0;
for(i=1;i<=t;i++){
if(t%i == 0){
count += 1;
}else{
;
}
}
if(count == 2){
prime += 1;
}else{
;
}
}
printf("%d\n",prime);
}
return 0;
}
|
main.c: In function 'main':
main.c:8:10: error: expected ';' before 'prime'
8 | 1
| ^
| ;
9 |
10 | prime = 0;
| ~~~~~
|
s867714523
|
p00009
|
C
|
#include<stdio.h>
int main (void)
{
int n,i,count,t,prime,l;
for(l=0;l<30;l++){
scanf("%d",&n);
1
prime = 0;
for(t=1;t<=n;t++){
count= 0;
for(i=1;i<=t;i++){
if(t%i == 0){
count += 1;
}else{
;
}
}
if(count == 2){
prime += 1;
}else{
;
}
}
printf("%d\n",prime);
}
return 0;
}
|
main.c: In function 'main':
main.c:8:10: error: expected ';' before 'prime'
8 | 1
| ^
| ;
9 |
10 | prime = 0;
| ~~~~~
|
s461337198
|
p00009
|
C
|
#include<stdio.h>
int main(void)
int i,j,n;
while(scanf("%d",&n)!=EOF) {
int num[1000000]={0};
for(i=2;i<=n/2;i++) {
for(j=2;j*i<n;j++) {
num[i*j]++;
}
}
for(i=2;i<=n;i++) {
if(num[i]==0)
printf("%d",&i);
} }
return 0;
}
|
main.c: In function 'main':
main.c:4:1: error: expected declaration specifiers before 'while'
4 | while(scanf("%d",&n)!=EOF) {
| ^~~~~
main.c:15:1: error: expected declaration specifiers before 'return'
15 | return 0;
| ^~~~~~
main.c:16:1: error: expected declaration specifiers before '}' token
16 | }
| ^
main.c:2:5: error: old-style parameter declarations in prototyped function definition
2 | int main(void)
| ^~~~
main.c:17: error: expected '{' at end of input
|
s536321857
|
p00009
|
C
|
#include<stdio.h>
int main(void) {
int i,j,n;
while(scanf("%d",&n)!=EOF) {
int num[1000000]={0};
for(i=2;i<=n/2;i++) {
for(j=2;j*i<n;j++) {
num[i*j]++;
}
}
for(i=2;i<=n;i++) {
if(num[i]==0)
printf("%d",&i);
} } }
return 0;
}
|
main.c:15:1: error: expected identifier or '(' before 'return'
15 | return 0;
| ^~~~~~
main.c:16:1: error: expected identifier or '(' before '}' token
16 | }
| ^
|
s337142629
|
p00009
|
C
|
#include<stdio.h>
int main(void) {
int i,j,n;
while(scanf("%d",&n)!=EOF) {
int num[1000000]={0};
for(i=2;i<=n/2;i++) {
for(j=2;j*i<n;j++) {
num[i*j]++;
}
}
for(i=2;i<=n;i++) {
if(num[i]==0)
printf("%d",i);
} } }
return 0;
}
|
main.c:15:1: error: expected identifier or '(' before 'return'
15 | return 0;
| ^~~~~~
main.c:16:1: error: expected identifier or '(' before '}' token
16 | }
| ^
|
s284065817
|
p00009
|
C
|
#include <stdio.h>
#include <math.h>
int b[999999];
int prime(int x) {
for (int i = 2; i < sqrt(x) + 1; i++) {
if (x%i == 0) {
return 0;
}
}
return 1;
}
int main(){
int n;
b[0] = 0;
b[1] = 0;
b[2] = 1;
int count = 1;
for (int i = 3; i <= 999999; i++) {
if (prime(i))count++;
b[i] = count;
}
while (scanf("%d", &n) != EOF){
printf("%d\n", b[n]);
}
return 0;
}
|
/usr/bin/ld: /tmp/ccuQaPrn.o: in function `prime':
main.c:(.text+0x4e): undefined reference to `sqrt'
collect2: error: ld returned 1 exit status
|
s923868734
|
p00009
|
C
|
#include <stdio.h>
#define MAX(1000001)
int prime[MAX];
int main()
{
int n, i, j;
for (i = 0; i < MAX; i++){
prime[i] = 1;
}
prime[0] = prime[1] = 0;
for (i = 2; i * i < MAX; i++){
if (prime[i] == 1){
for (j = i * i; j < MAX; j += i){
prime[j] = 0;
}
}
}
for (i = 1; i < MAX - 1; i++){
prime[i + 1] += prime[i];
}
while (scanf("%d", &n) != EOF){
printf("%d\n", prime[n]);
}
return (0);
}
|
main.c:3:13: error: expected parameter name, found "1000001"
3 | #define MAX(1000001)
| ^~~~~~~
main.c:5:11: error: 'MAX' undeclared here (not in a function)
5 | int prime[MAX];
| ^~~
|
s301727829
|
p00009
|
C
|
#include <stdio.h>
#define MAX_SIZE(1000001)
int prime[MAX_SIZE];
int main()
{
int n, i, j;
for (i = 0; i < MAX_SIZE; i++){
prime[i] = 1;
}
prime[0] = prime[1] = 0;
for (i = 2; i * i < MAX_SIZE; i++){
if (prime[i] == 1){
for (j = i * i; j < MAX_SIZE; j += i){
prime[j] = 0;
}
}
}
for (i = 1; i < MAX_SIZE - 1; i++){
prime[i + 1] += prime[i];
}
while (scanf("%d", &n) != EOF){
printf("%d\n", prime[n]);
}
return 0;
}
|
main.c:3:18: error: expected parameter name, found "1000001"
3 | #define MAX_SIZE(1000001)
| ^~~~~~~
main.c:5:11: error: 'MAX_SIZE' undeclared here (not in a function)
5 | int prime[MAX_SIZE];
| ^~~~~~~~
|
s483010439
|
p00009
|
C
|
int a,b=0,c=0,i,j,l,n,ans[3]={0};
for(a=0;a<=2;a++){
scanf("%d",&n);
if(n>=2){
for(i=2;i<=n;i++){
for(j=2;j<=i;j++){
if(i%j==0 && i!=j){
b++;
}
}
if(b==0){
ans[a]++;
}
else{
b=0;
}
}
}
}
printf("\n%d\n%d\n%d",ans[0],ans[1],ans[2]);
|
main.c:3:9: error: expected identifier or '(' before 'for'
3 | for(a=0;a<=2;a++){
| ^~~
main.c:3:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<=' token
3 | for(a=0;a<=2;a++){
| ^~
main.c:3:23: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
3 | for(a=0;a<=2;a++){
| ^~
main.c:24:16: error: expected declaration specifiers or '...' before string constant
24 | printf("\n%d\n%d\n%d",ans[0],ans[1],ans[2]);
| ^~~~~~~~~~~~~~
main.c:24:31: error: expected declaration specifiers or '...' before 'ans'
24 | printf("\n%d\n%d\n%d",ans[0],ans[1],ans[2]);
| ^~~
main.c:24:38: error: expected declaration specifiers or '...' before 'ans'
24 | printf("\n%d\n%d\n%d",ans[0],ans[1],ans[2]);
| ^~~
main.c:24:45: error: expected declaration specifiers or '...' before 'ans'
24 | printf("\n%d\n%d\n%d",ans[0],ans[1],ans[2]);
| ^~~
|
s633658883
|
p00009
|
C
|
#include <stdio.h>
#include <string.h>
int main()
{
char inp[96];
int n,i,flg,len,ans,k;
int dt[100];
/**--init --**/
for (;;) {
gets(inp);
len = strlen(inp);
if (len==0) {
return 1;
}
sscanf(inp,"%d",&n);
/**-- CALC --**/
ans=0;
for (i=2 ; i<=n ; i++) {
flg=0;
for (k=2 ; k<=i ; k++) {
if ((i%k)==0) {
// dt[flg]=i;
flg++;
}
}
if (flg==1) {
dt[ans]=i;
ans++;
}
}
printf("%d\n",ans);
????????????????????????break;
}
return 0;
}
|
main.c: In function 'main':
main.c:12:17: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
12 | gets(inp);
| ^~~~
| fgets
main.c:36:1: error: expected expression before '?' token
36 | ????????????????????????break;
| ^
|
s522535677
|
p00009
|
C
|
#include<stdio.h>
#include<math.h>
/*??????????????¨?????¢??° */
/*????????????0????????\????????¨???*/
void print_rist(bool *rist, int num){
int i = 2;
while(i <= num) {
if (rist[i] != 0) {
printf("%d ", i);
}
i++;
}
printf("\n");
}
main(){
bool rist[1000000];
int i, j,prime;
unsigned int input_num = 0;
unsigned int count;
unsigned int ans;
/*??????????????§????´???°????±???????????????\???*/
for(j = 0; j < 30; j++) {
scanf("%d", &input_num);
if (input_num == 0) {
break;
}
/*??¢?´¢??????????????????*/
for (i = 1; i <= input_num; i++) {
rist[i] = 1;
}
rist[i] = 0;
/*?´???°??????????????????*/
count = 2;
prime = 0;
while(count <= sqrt(input_num)) { /*???input_num??????????????§*/
i = 2;
/*count??\??????count????????°??????????????¨???*/
while((i * count) <= input_num) {
rist[i * count] = 0;
i++;
}
count++;
/*?¬????count?????????*/
while(rist[count] != 1) {
count++;
}
}
ans = 0;
i = 2;
for (i = 2; i <= input_num; i++) {
if (rist[i] != 0) {
ans++;
}
}
printf("%d\n", ans);
//print_rist(rist, input_num);
}
}
|
main.c:6:17: error: unknown type name 'bool'
6 | void print_rist(bool *rist, int num){
| ^~~~
main.c:3:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
2 | #include<math.h>
+++ |+#include <stdbool.h>
3 |
main.c:19:1: error: return type defaults to 'int' [-Wimplicit-int]
19 | main(){
| ^~~~
main.c: In function 'main':
main.c:20:9: error: unknown type name 'bool'
20 | bool rist[1000000];
| ^~~~
main.c:20:9: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
|
s527666138
|
p00009
|
C
|
#include <stdio.h>
const int MAX_V = 999999;
int main() {
int i, k, n;
int prime[MAX_V + 1], cnt[MAX_V + 1];
for( i = 2; i <= MAX_V; i++) {
prime[i] = 1;
}
for( i = 2; i * i <= MAX_V; i++) {
if(prime[i]) {
for( k = 2 * i; k <= MAX_V; k += i) {
prime[k] = 0;
}
}
}
cnt[0] = 0;
for( i = 0 i <= MAX_V; i++) {
cnt[i + 1] = cnt[i] + prime[i + 1];
}
while(scanf("%d", &n) != EOF) {
printf("%d\n", cnt[n]);
}
return 0;
}
|
main.c: In function 'main':
main.c:18:19: error: expected ';' before 'i'
18 | for( i = 0 i <= MAX_V; i++) {
| ^~
| ;
main.c:18:35: error: expected ';' before ')' token
18 | for( i = 0 i <= MAX_V; i++) {
| ^
| ;
|
s070927053
|
p00009
|
C
|
#include<stdio.h>
const int MAX_V = 10000;
int main(void){
int i,k,n;
int prime[MAX_V+1],sum[MAX_V+1] = {0},cnt[MAX_V] = {0};
for(i = 2; i < MAX_V; i ++){
prime[i] = 1;
cnt[i] ++;
}
for(i = 2; i * i < MAX_V; i ++){
if(prime[i]){
for(k = 2 * i; k < MAX_V; k += i){
prime[k] = 0;
cnt[k] = 0;
}
}
}
while(scanf("%d",&n) != EOF){
for(i = 2; i <= n; i ++){
sum[i+1] = sum[i] + cnt[i];
}
printf("%d\n",sum[n+1]);
}
return 0;
}
|
main.c: In function 'main':
main.c:5:39: error: variable-sized object may not be initialized except with an empty initializer
5 | int prime[MAX_V+1],sum[MAX_V+1] = {0},cnt[MAX_V] = {0};
| ^
main.c:5:56: error: variable-sized object may not be initialized except with an empty initializer
5 | int prime[MAX_V+1],sum[MAX_V+1] = {0},cnt[MAX_V] = {0};
| ^
|
s367945380
|
p00009
|
C
|
#include<stdio.h>
const int MAX_V = 10000;
int main(void){
int i,k,n;
int prime[MAX_V+1] = {0},sum[MAX_V+1] = {0},cnt[MAX_V] = {0};
for(i = 2; i < MAX_V; i ++){
prime[i] = 1;
cnt[i] ++;
}
for(i = 2; i * i < MAX_V; i ++){
if(prime[i]){
for(k = 2 * i; k < MAX_V; k += i){
prime[k] = 0;
cnt[k] = 0;
}
}
}
while(scanf("%d",&n) != EOF){
for(i = 2; i <= n; i ++){
sum[i+1] = sum[i] + cnt[i];
}
printf("%d\n",sum[n+1]);
}
return 0;
}
|
main.c: In function 'main':
main.c:5:26: error: variable-sized object may not be initialized except with an empty initializer
5 | int prime[MAX_V+1] = {0},sum[MAX_V+1] = {0},cnt[MAX_V] = {0};
| ^
main.c:5:45: error: variable-sized object may not be initialized except with an empty initializer
5 | int prime[MAX_V+1] = {0},sum[MAX_V+1] = {0},cnt[MAX_V] = {0};
| ^
main.c:5:62: error: variable-sized object may not be initialized except with an empty initializer
5 | int prime[MAX_V+1] = {0},sum[MAX_V+1] = {0},cnt[MAX_V] = {0};
| ^
|
s055480156
|
p00009
|
C
|
#include<stdio.h>
int main(void){
const int MAX_V = 10000;
int i,k,n;
int prime[MAX_V+1],sum[MAX_V+1] = {0};
for(i = 2; i < MAX_V; i ++){
prime[i] = 1;
}
for(i = 2; i * i < MAX_V; i ++){
if(prime[i]){
for(k = 2 * i; k < MAX_V; k += i){
prime[k] = 0;
}
}
}
for(i = 2; i < MAX_V; i ++){
sum[i+1] = sum[i] + prime[i];
}
while(scanf("%d",&n) != EOF){
printf("%d\n",sum[n+1]);
}
return 0;
}
|
main.c: In function 'main':
main.c:5:39: error: variable-sized object may not be initialized except with an empty initializer
5 | int prime[MAX_V+1],sum[MAX_V+1] = {0};
| ^
|
s524880062
|
p00009
|
C
|
#include<stdio.h>
int main(void){
const int MAX_V = 10000;
int i,k,n;
int prime[MAX_V+1],sum[MAX_V+1] = {0};
prime[0] = 0;
prime[1] = 0;
for(i = 2; i < MAX_V; i ++){
prime[i] = 1;
}
for(i = 2; i * i < MAX_V; i ++){
if(prime[i]){
for(k = 2 * i; k < MAX_V; k += i){
prime[k] = 0;
}
}
}
for(i = 2; i < MAX_V; i ++){
sum[i+1] = sum[i] + prime[i];
}
while(scanf("%d",&n) != EOF){
printf("%d\n",sum[n+1]);
}
return 0;
}
|
main.c: In function 'main':
main.c:5:39: error: variable-sized object may not be initialized except with an empty initializer
5 | int prime[MAX_V+1],sum[MAX_V+1] = {0};
| ^
|
s271941429
|
p00009
|
C
|
#include<stdio.h>
int main(void){
const int MAX_V = 10000;
int i,k,n;
int prime[MAX_V+1] = {0},sum[MAX_V+1] = {0};
for(i = 2; i < MAX_V; i ++){
prime[i] = 1;
}
for(i = 2; i * i < MAX_V; i ++){
if(prime[i]){
for(k = 2 * i; k < MAX_V; k += i){
prime[k] = 0;
}
}
}
for(i = 2; i < MAX_V; i ++){
sum[i+1] = sum[i] + prime[i];
}
while(scanf("%d",&n) != EOF){
printf("%d\n",sum[n+1]);
}
return 0;
}
|
main.c: In function 'main':
main.c:5:26: error: variable-sized object may not be initialized except with an empty initializer
5 | int prime[MAX_V+1] = {0},sum[MAX_V+1] = {0};
| ^
main.c:5:45: error: variable-sized object may not be initialized except with an empty initializer
5 | int prime[MAX_V+1] = {0},sum[MAX_V+1] = {0};
| ^
|
s726714806
|
p00009
|
C
|
#include<stdio.h>
const int MAX_V = 10000;
int prime[MAX_V+1],sum[MAX_V+1];
int main(void){
int i,k,n,ans;
for(i = 0; i < MAX_V + 1; i ++){
prime[i] = 1;
sum[i] = 0;
}
prime[0] = 0;
prime[1] = 0;
for(i = 2; i * i < MAX_V; i ++){
if(prime[i]){
for(k = 2 * i; k < MAX_V; k += i){
prime[k] = 0;
}
}
}
for(i = 2; i < MAX_V; i ++){
sum[i+1] = sum[i] + prime[i];
}
while(scanf("%d",&n) != EOF){
ans = sum[n+1];
printf("%d\n",ans);
}
return 0;
}
|
main.c:3:5: error: variably modified 'prime' at file scope
3 | int prime[MAX_V+1],sum[MAX_V+1];
| ^~~~~
main.c:3:20: error: variably modified 'sum' at file scope
3 | int prime[MAX_V+1],sum[MAX_V+1];
| ^~~
|
s214814466
|
p00009
|
C
|
#include <stdio.h>
const int MAX_V = 1000000;
int prime[MAX_V + 1];
int main(){
//?´???°??¨??????
int i, k;
for( i = 2; i <= MAX_V; i++) {
prime[i] = 1;
}
for( i = 2; i * i <= MAX_V; i++){
if(prime[i]) {
for( k = 2 * i; k <= MAX_V; k += i){
prime[k] = 0;
}
}
}
//?´???????????±???????
int sum[MAX_V + 2];
sum[2] = 0;
for( i = 2; i <= MAX_V; i++){
sum[i + 1] = sum[i] + prime[i];
}
//??\?????¨??????
int n;
while(scanf("%d", &n) != EOF){
printf("%d\n", sum[n + 1]);
}
return 0;
}
|
main.c:3:5: error: variably modified 'prime' at file scope
3 | int prime[MAX_V + 1];
| ^~~~~
|
s367022364
|
p00009
|
C
|
#include <stdio.h>
const int MAX_V = 1000000;
int prime[MAX_V+1];
int main(){
//?´???°??¨??????
int i, k;
for( i = 2; i <= MAX_V; i++) {
prime[i] = 1;
}
for( i = 2; i * i <= MAX_V; i++){
if(prime[i]) {
for( k = 2 * i; k <= MAX_V; k += i){
prime[k] = 0;
}
}
}
//?´???????????±???????
int sum[MAX_V + 2];
sum[2] = 0;
for( i = 2; i <= MAX_V; i++){
sum[i + 1] = sum[i] + prime[i];
}
//??\?????¨??????
int n;
while(scanf("%d", &n) != EOF){
printf("%d\n", sum[n + 1]);
}
return 0;
}
|
main.c:3:5: error: variably modified 'prime' at file scope
3 | int prime[MAX_V+1];
| ^~~~~
|
s511018876
|
p00009
|
C
|
#include <stdio.h>
const int MAX_V = 999999;
int prime[MAX_V+1];
int main(){
//?´???°??¨??????
int i, k;
for( i = 2; i <= MAX_V; i++) {
prime[i] = 1;
}
for( i = 2; i * i <= MAX_V; i++){
if(prime[i]) {
for( k = 2 * i; k <= MAX_V; k += i){
prime[k] = 0;
}
}
}
//?´???????????±???????
int sum[MAX_V + 2];
sum[2] = 0;
for( i = 2; i <= MAX_V; i++){
sum[i + 1] = sum[i] + prime[i];
}
//??\?????¨??????
int n;
while(scanf("%d", &n) != EOF){
printf("%d\n", sum[n + 1]);
}
return 0;
}
|
main.c:3:5: error: variably modified 'prime' at file scope
3 | int prime[MAX_V+1];
| ^~~~~
|
s064608145
|
p00009
|
C
|
#include <stdio.h>
const int MAX_V = 999999;
int prime[MAX_V+1];
int main(){
//?´???°??¨??????
int i, k;
for( i = 2; i <= MAX_V; i++) {
prime[i] = 1;
}
for( i = 2; i * i <= MAX_V; i++){
if(prime[i]) {
for( k = 2 * i; k <= MAX_V; k += i){
prime[k] = 0;
}
}
}
//?´???????????±???????
int sum[MAX_V + 2];
sum[2] = 0;
for( i = 2; i <= MAX_V; i++){
sum[i + 1] = sum[i] + prime[i];
}
//??\?????¨??????
int n;
while(scanf("%d", &n) != EOF){
printf("%d\n", sum[n + 1]);
}
return 0;
}
|
main.c:3:5: error: variably modified 'prime' at file scope
3 | int prime[MAX_V+1];
| ^~~~~
|
s578614119
|
p00009
|
C
|
#include <Stdio.h>
int main()
{
int n,i,j,flag=0,cnt,h,k;
while(scanf("%d",&n))
{
if(n==2)
printf("1");
else if(n==3)
printf("2");
else
{
cnt=2;
h=n/2;
for(k=4; k<=n; k++)
{
for(j=2; j<=h; j+=2)
{
if(k%j==0)
{
flag=1;
break;
}
}
if(flag==0)
cnt++;
else
flag=0;
}
printf("%d",cnt-1);
}
}
return 0;
}
|
main.c:1:10: fatal error: Stdio.h: No such file or directory
1 | #include <Stdio.h>
| ^~~~~~~~~
compilation terminated.
|
s426871712
|
p00009
|
C
|
#include <stdio.h>
int prime[999999];
int main() {
int i, k, n, N = 0;
for(i = 2; i <= 999999; i++) {
prime[i] = 1;
}
for(i = 2; i*i <= 999999; i++) {
if(prime[i]) {
for(k = 2 * i; k <= 999999; k += i) {
prime[k] = 0;
}
}
}
for(i = 2; i <= 999999; i++) {
if(prime[i] == 1){
N++;
prime[i] = N;
}else if(prime[i] == 0){
prime[i] = N;
}
while(scanf("%d", &n) != EOF){
printf("%d\n", prime[n]);
}
return 0;
}
|
main.c: In function 'main':
main.c:28:1: error: expected declaration or statement at end of input
28 | }
| ^
|
s907982036
|
p00009
|
C
|
#include <cstdio>
#include <cstring>
const int MAX_n = 999999;
bool isPrime[MAX_n+1];
int sum[MAX_n+1];
int main()
{
memset(isPrime,true,sizeof(isPrime));
for(int i = 2; 2*i <= MAX_n ; ++i)
if(isPrime[i])
for(int j = 2*i; j <= MAX_n; j+=i)
isPrime[j] = false;
isPrime[0] = isPrime[1] = false;
for(int i = 0; i < MAX_n; ++i)
sum[i+1] = sum[i] + isPrime[i+1];
int n;
while(scanf("%d",&n) != EOF)
{
int ans = sum[n];
printf("%d\n",ans);
}
}
|
main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s250739964
|
p00009
|
C
|
#include "stdio.h"
#define MAX_N 999999
bool is_prime[MAX_N+1];
int sieve(int n)
{
int p=0,i;
for(i=0;i<=n;i++) is_prime[i]=true;
is_prime[0]=is_prime[1]=false;
for(i=2;i<=n;i++)
{
if(is_prime[i])
{
p++;
for(int j=2*i;j<=n;j+=i) is_prime[j]=false;
}
}
return p;
}
int main()
{
int n;
while(scanf("%d",&n)!=EOF)
{
printf("%d\n",sieve(n));
}
return 0;
}
|
main.c:3:1: error: unknown type name 'bool'
3 | bool is_prime[MAX_N+1];
| ^~~~
main.c:2:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
1 | #include "stdio.h"
+++ |+#include <stdbool.h>
2 | #define MAX_N 999999
main.c: In function 'sieve':
main.c:7:39: error: 'true' undeclared (first use in this function)
7 | for(i=0;i<=n;i++) is_prime[i]=true;
| ^~~~
main.c:7:39: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:7:39: note: each undeclared identifier is reported only once for each function it appears in
main.c:8:33: error: 'false' undeclared (first use in this function)
8 | is_prime[0]=is_prime[1]=false;
| ^~~~~
main.c:8:33: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
|
s825379964
|
p00009
|
C
|
#include <stdio.h>
int prime[2000000];
int main(void)
{
int n;
int i, j;
prime[2] = 1;
for (i = 3; i < 1000000; i += 2){
for (j = 3; j * j <= i; j += 2){
if (i % j == 0){
break;
}
}
prime[i] = prime[i - 1];
prime[i + 1] = prime[i - 1];
if (j * j > i){
prime[i]++;
prime[i + 1]++;
}
}
while (~scanf("%d", &n)){
printf("%d\n", prime[n]);
}
return (0);
}
#include <stdio.h>
int prime[2000000];
int main(void)
{
int n;
int i, j;
prime[2] = 1;
for (i = 3; i < 1000000; i += 2){
for (j = 3; j * j <= i; j += 2){
if (i % j == 0){
break;
}
}
prime[i] = prime[i - 1];
prime[i + 1] = prime[i - 1];
if (j * j > i){
prime[i]++;
prime[i + 1]++;
}
}
while (~scanf("%d", &n)){
printf("%d\n", prime[n]);
}
return (0);
}
|
main.c:34:5: error: redefinition of 'main'
34 | int main(void)
| ^~~~
main.c:5:5: note: previous definition of 'main' with type 'int(void)'
5 | int main(void)
| ^~~~
|
s357523170
|
p00009
|
C
|
//?´???°????????°????±???????????????°??????
#include <stdio.h>
int main(void)
{
int num;
int i, j;
int flag;
int count = 0;
scanf("%d", &num);
for(i=2; i<=num; i++){
flag = 0;
for(j=2; j<num; j++){
if(i!=j && i%j==0 ){
flag = 1;
// printf("%d %d\n", i, j);
break;
}
}
if(flag == 0) {
// printf("i %d\n", i);
count++;
}
}
printf("%d\n", count);
return 0;
|
main.c: In function 'main':
main.c:35:9: error: expected declaration or statement at end of input
35 | return 0;
| ^~~~~~
|
s092341235
|
p00009
|
C
|
#include <iostream>
#include <string>
#include <stack>
#include <math.h>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <vector>
using namespace std;
int sieve(int n);
int prime[1000000];
bool is_prime[1000000];
int main()
{
int p = 0;
for (int i = 0; i <= 999999; i++) {
is_prime[i] = true;
}
is_prime[0] = is_prime[1] = false;
for (int i = 2; i <= 999999; i++) {
if (is_prime[i]) {
prime[p++] = i;
for (int j = 2 * i; j <= 999999; j += i) {
is_prime[j] = false;
}
}
}
int n;
while (scanf_s("%d", &n) != EOF) {
int i = 0;
while (prime[i] <= n) {
i++;
}
cout << i << endl;
}
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s244615993
|
p00009
|
C
|
#include<stdio.h>
#include<math.h>
int prime(int n);
int main()
{
int k,j,n;
int store,sum=0;
while(scanf("%d",&n)!=EOF)
{
for(j=1;j<=n;j++)
{
store=prime(j);
if(store==1)
{
sum++;
}
}
printf("%d\n",sum);
sum=0;
}
return 0;
}
int prime(int n)
{
int i;
float x,k;
int l;
x=float(n);
k=sqrt(x);
l=int(k);
if(n==1 || n==0)
{
return 0;
}
if(n==2)
{
return 1;
}
for(i=2;i<=l;i++)
{
if(n%i==0)
{
return 0;
}
}
return 1;
}
|
main.c: In function 'prime':
main.c:42:11: error: expected expression before 'float'
42 | x=float(n);
| ^~~~~
main.c:45:11: error: expected expression before 'int'
45 | l=int(k);
| ^~~
|
s309330429
|
p00009
|
C
|
#include <stdio.h>
#include <math.h>
#define N 1000000
int main(){
int i, j, n, answer;
int a[N];
for(i=0; i<N; ++i) a[i]=0;
a[2] = 1;
for(i=3; i<N; i+=2) a[i]=1;
for(i=3; i<=N-1; i+=2){
if(a[i]==0) continue;
for(j=i+i; j<N; j+=i) a[j] = 0;
}
while(scanf("%d", &n) != EOF){
answer = 0;
for(i=0;i<=n;++i){
answer+=a[i];
}
printf("%d\n", answer);
}
return 0
}
|
main.c: In function 'main':
main.c:21:17: error: expected ';' before '}' token
21 | return 0
| ^
| ;
22 | }
| ~
|
s007626887
|
p00009
|
C
|
/*
Volume0-0009
*/
//#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#define N 1000000
#define TRUE (int)(0==0)
#define FALSE !TRUE
#define BUFLEN 1024
//using std;
int syserr(char *str)
{
fputs(str, stderr);
exit(-1);
}
int main(int argc, char *argv[]){
int f[N];
memset(f, TRUE, N);
f[1]=FALSE;
for (int i=3; i<N; i++){
if (f[i] == TRUE ) {
for (int j=i+i; j<N; j+=i){
f[j] = FALSE;
}
}
}
for (int i=3; i<N; i+=2) {
if (f[i/2-1]) {
x = x + 1;
}
f[i/2-1]=x;
}
char buf[BUFLEN];
while (fgets(buf, BUFLEN, stdin) != NULL){
int n = atoi(buf);
int m = 0;
for (int i=1; i<=n; i++){
if (f[i]){
m++;
}
}
printf("%d\n", m);
exit(0);
}
|
main.c: In function 'main':
main.c:22:3: error: implicit declaration of function 'memset' [-Wimplicit-function-declaration]
22 | memset(f, TRUE, N);
| ^~~~~~
main.c:7:1: note: include '<string.h>' or provide a declaration of 'memset'
6 | #include <stdlib.h>
+++ |+#include <string.h>
7 |
main.c:22:3: warning: incompatible implicit declaration of built-in function 'memset' [-Wbuiltin-declaration-mismatch]
22 | memset(f, TRUE, N);
| ^~~~~~
main.c:22:3: note: include '<string.h>' or provide a declaration of 'memset'
main.c:34:7: error: 'x' undeclared (first use in this function)
34 | x = x + 1;
| ^
main.c:34:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:52:1: error: expected declaration or statement at end of input
52 | }
| ^
|
s729262291
|
p00009
|
C
|
#include<stdio.h>
int main(void){
int x,i,t=0;
while(scanf("%d",&x)!=EOF){
for(i=2;i*i<x){
if(x%i==0)
break;
t++;
}
printf("%d",t);
}
return 0;
}
|
main.c: In function 'main':
main.c:5:14: error: expected ';' before ')' token
5 | for(i=2;i*i<x){
| ^
| ;
|
s326265338
|
p00009
|
C
|
#include <stdio.h>
int main(void){
int n;
int a,b;
int cnt1,cnt2;
while(1){
n=-1;
cnt1=0;
cnt2=0;
scanf("%d", &n);
if(n==-1)break;
if(n==1){
puts("0");
continue;
}
if(n==2){
puts("1");
continue;
}
for(a=3; a<=n; a++){
for(b=1; b<=a; b++){
if(n % a == 0)cnt++;
}
if(cnt1 == 2)cnt2++;
}
printf("%d\n", cnt2);
}
return 0;
}
|
main.c: In function 'main':
main.c:27:30: error: 'cnt' undeclared (first use in this function); did you mean 'cnt2'?
27 | if(n % a == 0)cnt++;
| ^~~
| cnt2
main.c:27:30: note: each undeclared identifier is reported only once for each function it appears in
|
s601169846
|
p00009
|
C
|
#include<stdio.h>
#include<Math.h>
int main(){
int n;
int a[30][10000];
int b;
int i, j, p;
int c[30];
p = 0;
while (scanf("%d", &n) != EOF){
b = (int)pow((double)n, 0.5);
c[p] = 0;
a[p][0] = -1;
for (i = 2; i <= b; i++){
for (j = 2; j <= n / i; j++){
a[p][i*j - 1] = -1;
}
}
for (i = 1; i <= n; i++){
if (a[p][i - 1] != -1){ c[p]++; }
}
p++;
}
for (i = 0; i < p; i++){
printf("%d",c[i]);
}
return 0;
}
|
main.c:2:9: fatal error: Math.h: No such file or directory
2 | #include<Math.h>
| ^~~~~~~~
compilation terminated.
|
s777991889
|
p00009
|
C
|
#include<stdio.h>
#include<Math.h>
int main(){
int n;
int a[10000];
int b;
int i, j, p;
int c[30];
p = 0;
while (scanf("%d", &n) != EOF){
b = (int)pow((double)n, 0.5);
c[p] = 0;
a[0] = -1;
for (i = 2; i <= b; i++){
for (j = 2; j <= n / i; j++){
a[i*j - 1] = -1;
}
}
for (i = 1; i <= n; i++){
if (a[i - 1] != -1){ c[p]++; }
a[i - 1] = 0;
}
p++;
}
for (i = 0; i < p; i++){
printf("%d\n", c[i]);
}
scanf("%d", &n);
return 0;
}
|
main.c:2:9: fatal error: Math.h: No such file or directory
2 | #include<Math.h>
| ^~~~~~~~
compilation terminated.
|
s282525764
|
p00009
|
C
|
#include<stdio.h>
#include<Math.h>
int main(){
int n;
int a[10000];
int b;
int i, j, p;
int c[30];
p = 0;
while (scanf("%d", &n) != EOF){
b = (int)pow((double)n, 0.5);
c[p] = 0;
a[0] = -1;
for (i = 2; i <= b; i++){
for (j = 2; j <= n / i; j++){
a[i*j - 1] = -1;
}
}
for (i = 1; i <= n; i++){
if (a[i - 1] != -1){ c[p]++; }
a[i - 1] = 0;
}
p++;
}
for (i = 0; i < p; i++){
printf("%d\n", c[i]);
}
return 0;
}
|
main.c:2:9: fatal error: Math.h: No such file or directory
2 | #include<Math.h>
| ^~~~~~~~
compilation terminated.
|
s458562153
|
p00009
|
C
|
#include<stdio.h>
int prime_elements[1000001]={0};
int main(void){
int i,j,result,num_input;
for(i=2;i<=1000000;i++){
if(prime_elements[i]==0){
for(j=2;i*j<=1000000;j++){
prime_elements[i*j]=1;
}
}
}
while(scanf("%d",&num_input)!=EOF){
result=0;
for(i=2;i<=input;i++){
if(prime_elements[i]==0){
result++;
}
}
printf("%d\n",result);
}
return 0;
}
|
main.c: In function 'main':
main.c:16:20: error: 'input' undeclared (first use in this function); did you mean 'int'?
16 | for(i=2;i<=input;i++){
| ^~~~~
| int
main.c:16:20: note: each undeclared identifier is reported only once for each function it appears in
|
s768178706
|
p00009
|
C
|
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
bool is_prime_num(int n) {
if (n < 2) {
return false;
} else if (n == 2) {
return true;
} else if (n % 2 == 0) {
return false;
}
for (int i = 3; i <= (int)sqrt(n); i+=2) {
if (n % i == 0) {
return false;
}
}
return true;
}
int count_prime_num(int n) {
int acc = 0;
for (int i = 2; i <= n; i++) {
if (is_prime_num(i)) {
acc++;
}
}
return acc;
}
int main() {
char line[256];
if (fgets(line, 256, stdin)) {
printf("%d\n", count_prime_num(atoi(line)));
}
}
|
/usr/bin/ld: /tmp/ccpoGAXe.o: in function `is_prime_num':
main.c:(.text+0x6b): undefined reference to `sqrt'
collect2: error: ld returned 1 exit status
|
s722079952
|
p00009
|
C
|
#include<stdio.h>
#include<math.h>
int isprime(int x){
int i;
if(x==2)
return 1;
if(x<2 || x%2 == 0)
return 0;
for(i=3;i<=sqrt(double(x));i+=2)
if(x%i == 0)
return 0;
return 1;
}
int main(){
int count = 0;
int i,n;
double a;
while(scanf("%d",&n) != EOF){
for(i=1;i<=n;i++)
count += isprime(i);
printf("%d\n",count);
count = 0;
}
return 0;
}
|
main.c: In function 'isprime':
main.c:9:25: error: expected expression before 'double'
9 | for(i=3;i<=sqrt(double(x));i+=2)
| ^~~~~~
|
s502121292
|
p00009
|
C
|
#include<stdio.h>
#include<math.h>
int isprime(int x){
int i;
double a = sqrt(double(x));
if(x==2)
return 1;
if(x<2 || x%2 == 0)
return 0;
for(i=3;i<=int(a);i+=2)
if(x%i == 0)
return 0;
return 1;
}
int main(){
int count = 0;
int i,n;
double a;
while(scanf("%d",&n) != EOF){
for(i=1;i<=n;i++)
count += isprime(i);
printf("%d\n",count);
count = 0;
}
return 0;
}
|
main.c: In function 'isprime':
main.c:5:25: error: expected expression before 'double'
5 | double a = sqrt(double(x));
| ^~~~~~
main.c:10:20: error: expected expression before 'int'
10 | for(i=3;i<=int(a);i+=2)
| ^~~
|
s854107776
|
p00009
|
C
|
#include<stdio.h>
#include<math.h>
int isprime(int x){
int i;
if(x==2)
return 1;
if(x<2 || x%2 == 0)
return 0;
for(i=3;i<=sqrt(double(x));i+=2)
if(x%i == 0)
return 0;
return 1;
}
int main(){
int count = 0;
int i,n;
while(scanf("%d",&n) != EOF){
for(i=1;i<=n;i++)
count += isprime(i);
printf("%d\n",count);
count = 0;
}
return 0;
}
|
main.c: In function 'isprime':
main.c:9:25: error: expected expression before 'double'
9 | for(i=3;i<=sqrt(double(x));i+=2)
| ^~~~~~
|
s181994775
|
p00009
|
C
|
#include <stdio.h>
int main()
{
int n, i, j;
int ans;
char era[1000000];
while(scanf("%d", &n) != EOF){
era[i] = {1};
ans=0;
for(i=2; i<=n; i++){
if(era[i] == 1){
ans++;
for(j=i; j<=n; j+=i) era[j]=0;
}
}
printf("%d\n", ans);
}
return 0;
}
|
main.c: In function 'main':
main.c:11:14: error: expected expression before '{' token
11 | era[i] = {1};
| ^
|
s447389288
|
p00009
|
C
|
#include <stdio.h>
int main()
{
int n, i, j;
int ans;
char era[1000000];
while(scanf("%d", &n) != EOF){
era[] = {1};
ans=0;
for(i=2; i<=n; i++){
if(era[i] == 1){
ans++;
for(j=i; j<=n; j+=i) era[j]=0;
}
}
printf("%d\n", ans);
}
return 0;
}
|
main.c: In function 'main':
main.c:11:9: error: expected expression before ']' token
11 | era[] = {1};
| ^
|
s961823680
|
p00009
|
C
|
#include<stdio.h>
int main(){
int n,i,wareta;
wareta = 0;
while(scanf("%d\n", &n) != EOF){
for(i=2,i<n;i++){
if(n%i == 0){wareta=wareta+1;}
}
printf("%d\n", sprintf(hoge, "%d", a+b));
}
return 0;
}
|
main.c: In function 'main':
main.c:11:18: error: expected ';' before ')' token
11 | for(i=2,i<n;i++){
| ^
| ;
main.c:16:24: error: 'hoge' undeclared (first use in this function)
16 | printf("%d\n", sprintf(hoge, "%d", a+b));
| ^~~~
main.c:16:24: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:36: error: 'a' undeclared (first use in this function)
16 | printf("%d\n", sprintf(hoge, "%d", a+b));
| ^
main.c:16:38: error: 'b' undeclared (first use in this function)
16 | printf("%d\n", sprintf(hoge, "%d", a+b));
| ^
|
s963655126
|
p00009
|
C
|
#include<stdio.h>
int main(){
int n,i,cnt=0,sw=1,sosuu[1000000],t;
while(scanf("%d\n", &n) != EOF){
if(n>1){
sosuu[cnt]=2
cnt++;
for(i=3;i<=n;i+=2){
sw=1;
for(t=0;t<cnt&&sosuu[t]*sosuu[t]<=i;t++){
if(i%sosuu[t] == 0){
sw=0;
break;
}
}
if(sw==1){
sosuu[cnt]=i;
cnt++;
}
}
else{cnt=0;}
}
printf("%d\n", cnt);
}
return 0;
}
|
main.c: In function 'main':
main.c:10:17: error: expected ';' before 'cnt'
10 | sosuu[cnt]=2
| ^
| ;
11 | cnt++;
| ~~~
main.c:25:4: error: expected '}' before 'else'
25 | else{cnt=0;}
| ^~~~
main.c: At top level:
main.c:34:5: error: expected identifier or '(' before 'return'
34 | return 0;
| ^~~~~~
main.c:35:1: error: expected identifier or '(' before '}' token
35 | }
| ^
|
s213990742
|
p00009
|
C
|
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
int main()
{
long long a,b,ans;
int t;
scanf("%d",&t);
while (t--)
{
scanf("%lld%lld",&a,&b);
ans=(b-a+1)*(a+b)/2-a-a+2;
printf("%lld\n",ans);
}
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s476450287
|
p00009
|
C
|
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll a[1000000],p[1000000];
ll sieve( ll n)
{
ll i,j,k=0,m;
a[0]=1;
a[1]=1;
p[k++]=2;
m=sqrt(n);
for(i=4; i<=n; i+=2)
a[i]=1;
for(i=3; i<=m; i+=2)
if(a[i]==0)
for(j=i*i; j<=n; j+=i*2)
a[j]=1;
for(i=3; i<=n; i+=2)
if(a[i]==0)
p[k++]=i;
return k;
}
int main()
{
ll n,i,sz;
while(cin>>n)
{
sz = sieve(n);
cout<<sz<<'\n';
}
return 0;
}
|
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
1 | #include <bits/stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s084983761
|
p00009
|
C
|
#include <stdio.h>
int is_prime(int);
int main()
{
int input_count;
int prime_count;
int input;
int for_cnt;
int output_array[30];
for(for_cnt = 0; for_cnt < 30; for_cnt++)
{ac
output_array[for_cnt] = 0;
}
input_count = 0;
while(input_count < 30)
{
scanf("%d", &input);
if(input > 999999 || input < 1) /*Check input validity*/
{
printf("Invlaid input (1-999999)\n");
continue;
}
prime_count = 0;
for(for_cnt = 2; for_cnt <= input; for_cnt++)
{
if(is_prime(for_cnt))
{
prime_count++;
}
}
output_array[input_count] = prime_count;
input_count++;
}
output_array[input_count] = -1; /*For end tag*/
input_count = 0;
while(output_array[input_count] != -1)
{
printf("%d\n", output_array[input_count]);
input_count++;
}
return 0;
}
int is_prime(int test_num)
{
int divisor = 2; /*Least prime number*/
for( ; divisor < test_num; ++divisor)
{
if(test_num % divisor == 0)
{
return 0
}
}
return 1;
}
|
main.c: In function 'main':
main.c:14:10: error: unknown type name 'ac'
14 | {ac
| ^~
main.c:15:41: error: variable-sized object may not be initialized except with an empty initializer
15 | output_array[for_cnt] = 0;
| ^
main.c: In function 'is_prime':
main.c:63:33: error: expected ';' before '}' token
63 | return 0
| ^
| ;
64 | }
| ~
|
s521453827
|
p00009
|
C
|
#include <stdio.h>
int is_prime(int);
int main()
{
int input_count;
int prime_count;
int input;
int for_cnt;
int output_array[30];
for(for_cnt = 0; for_cnt < 30; for_cnt++)
{ac
output_array[for_cnt] = 0;
}
input_count = 0;
while(input_count < 30)
{
scanf("%d", &input);
if(input > 999999 || input < 1) /*Check input validity*/
{
printf("Invlaid input (1-999999)\n");
continue;
}
prime_count = 0;
for(for_cnt = 2; for_cnt <= input; for_cnt++)
{
if(is_prime(for_cnt))
{
prime_count++;
}
}
output_array[input_count] = prime_count;
input_count++;
}
output_array[input_count] = -1; /*For end tag*/
input_count = 0;
while(output_array[input_count] != -1)
{
printf("%d\n", output_array[input_count]);
input_count++;
}
return 0;
}
int is_prime(int test_num)
{
int divisor = 2; /*Least prime number*/
for( ; divisor < test_num; ++divisor)
{
if(test_num % divisor == 0)
{
return 0
}
}
return 1;
}
|
main.c: In function 'main':
main.c:14:10: error: unknown type name 'ac'
14 | {ac
| ^~
main.c:15:41: error: variable-sized object may not be initialized except with an empty initializer
15 | output_array[for_cnt] = 0;
| ^
main.c: In function 'is_prime':
main.c:63:33: error: expected ';' before '}' token
63 | return 0
| ^
| ;
64 | }
| ~
|
s887087270
|
p00009
|
C
|
#include <stdio.h>
int is_prime(int);
int main()
{
int input_count;
int prime_count;
int input;
int for_cnt;
int output_array[30];
for(for_cnt = 0; for_cnt < 30; for_cnt++)
{
output_array[for_cnt] = 0;
}
input_count = 0;
while(input_count < 30)
{
scanf("%d", &input);
if(input > 999999 || input < 1) /*Check input validity*/
{
printf("Invlaid input (1-999999)\n");
continue;
}
prime_count = 0;
for(for_cnt = 2; for_cnt <= input; for_cnt++)
{
if(is_prime(for_cnt))
{
prime_count++;
}
}
output_array[input_count] = prime_count;
input_count++;
}
if(input_count < 30)
{
output_array[input_count] = -1; /*For end tag*/
}
input_count = 0;
while(input_count < 30 && output_array[input_count] != -1)
{
printf("%d\n", output_array[input_count]);
input_count++;
}
return 0;
}
BOOL is_prime(int test_num)
{
int divisor = 2; /*Least prime number*/
for( ; divisor < test_num; ++divisor)
{
if(test_num % divisor == 0)
{
return 0;
}
}
return 1;
}
|
main.c:61:1: error: unknown type name 'BOOL'
61 | BOOL is_prime(int test_num)
| ^~~~
|
s430591340
|
p00009
|
C
|
#include <stdio.h>
#include <stdlib.h>
typedef int BOOL;
#define TRUE 1;
#define FALSE 0;
int is_prime(int);
int main()
{
int input_count;
int prime_count;
int input;
int for_cnt;
int output_array[30];
for(for_cnt = 0; for_cnt < 30; for_cnt++)
{
output_array[for_cnt] = 0;
}
input_count = 0;
do
{
scanf("%d", &input);
prime_count = 0;
for(for_cnt = 2; for_cnt <= input; for_cnt++)
{
if(is_prime(for_cnt))
{
prime_count++;
}
}
output_array[input_count] = prime_count;
input_count++;
}
while(input_count < 30 && input != 0)
if(input_count < 30)
{
output_array[input_count] = -1; /*For end tag*/
}
input_count = 0;
while(input_count < 30 && output_array[input_count] != -1)
{
printf("%d\n", output_array[input_count]);
input_count++;
}
return 0;
}
BOOL is_prime(int test_num)
{
int divisor = 2; /*Least prime number*/
for( ; divisor < test_num; ++divisor)
{
if(test_num % divisor == 0)
{
return FALSE;
}
}
return TRUE;
}
|
main.c: In function 'main':
main.c:44:46: error: expected ';' before 'if'
44 | while(input_count < 30 && input != 0)
| ^
| ;
45 |
46 | if(input_count < 30)
| ~~
|
s919479100
|
p00009
|
C
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int is_prime(int test_num)
{
int divisor;
if(test_num == 1)
{
return 0;
}
else if(test_num == 2 || test_num == 3 || test_num == 5 || test_num == 7)
{
return 1;
}
else if((test_num % 2) == 0)
{
return 0;
}
for(divisor = 3 ; divisor <= (sqrt(test_num) + 1); divisor += 2)
{
if(test_num % divisor == 0)
{
return 0;
}
}
return 1;
}
int main()
{
int input_count;
int prime_count;
int input;
int for_cnt;
int output[30];
input_count = 0;
while(scanf("%d", &input) != EOF && input_count < 30)
{
prime_count = 0;
if(input >= 2)
{
prime_count++;
}
for_cnt = 3;
while(for_cnt <= input)
{
if(is_prime(for_cnt))
{
prime_count++;
}
for_cnt += 2;
}
output[input_count] = prime_count;
input_count++;
}
for(for_cnt = 0; for_cnt < input_count; for_cnt++)
{
printf("%d\n", output[for_cnt]);
}
return 0;
}
int is_prime(int test_num)
{
int divisor;
if(test_num == 1)
{
return 0;
}
else if(test_num == 2 || test_num == 3 || test_num == 5 || test_num == 7)
{
return 1;
}
else if((test_num % 2) == 0)
{
return 0;
}
for(divisor = 3 ; divisor <= (sqrt(test_num) + 1); divisor += 2)
{
if(divisor % 3 == 0)
{
continue;
}
if(divisor % 5 == 0)
{
continue;
}
if(divisor % 7 == 0)
{
continue;
}
if(test_num % divisor == 0)
{
return 0;
}
}
return 1;
}
|
main.c:74:5: error: redefinition of 'is_prime'
74 | int is_prime(int test_num)
| ^~~~~~~~
main.c:5:5: note: previous definition of 'is_prime' with type 'int(int)'
5 | int is_prime(int test_num)
| ^~~~~~~~
|
s215471630
|
p00009
|
C
|
#include <stdio.h>
#include <math.h>
int is_prime1(int);
int is_prime2(int);
int prime[168];
int main()
{
int input, input_count, prime_count, cnt;
int output[30];
/*Make prime table*/
prime[0] = 2;
prime_cnt = 1;
for(cnt = 3; cnt < 1000; cnt += 2)
{
if(is_prime1(cnt))
{
prime[prime_cnt] = cnt;
prime_cnt++;
}
}
/*Get, calculate input then save in output[]*/
input_count = 0;
while(scanf("%d", &input) != EOF)
{
prime_count = 0;
if(input >= 2)
{
prime_count++;
}
for(cnt = 3; cnt <= input; cnt += 2)
{
if(is_prime2(cnt))
{
prime_count++;
}
}
output[input_count] = prime_count;
input_count++;
}
/*print output[]*/
for(cnt = 0; cnt < input_count; cnt++)
{
printf("%d\n", output[cnt]);
}
return 0;
}
/*Test prime directly*/
int is_prime1(int prime1_input)
{
int prime1_cnt;
if(prime1_input == 1)
{
return 0;
}
else if(prime1_input == 2 || prime1_input == 3 || prime1_input == 5 || prime1_input == 7)
{
return 1;
}
else if((prime1_input % 2) == 0)
{
return 0;
}
for(prime1_cnt = 3 ; prime1_cnt <= (sqrt(prime1_input)); prime1_cnt += 2)
{
if(prime1_input % prime1_cnt == 0)
{
return 0;
}
}
return 1;
}
/*Test prime with prime table*/
int is_prime2(int prime2_input)
{
int prime2_cnt = 0;
for( ;prime2_cnt <168; prime2_cnt++)
{
if(prime[prime2_cnt] > sqrt(prime2_input))
{
break;
}
if(prime2_input % prime[prime2_cnt] == 0)
{
return 0;
}
}
return 1;
}
|
main.c: In function 'main':
main.c:16:9: error: 'prime_cnt' undeclared (first use in this function); did you mean 'prime_count'?
16 | prime_cnt = 1;
| ^~~~~~~~~
| prime_count
main.c:16:9: note: each undeclared identifier is reported only once for each function it appears in
|
s292039226
|
p00009
|
C
|
#include <stdio.h>
int main(){
int n;
int num
while( scanf("%d", &n) > 0){
int i,j;
for(i=2; i<=n; i++){
for(j=2; j<=i; j++){
if( (i%j) == 0 ) break;
else continue;
if( i == j )
num++;
}
}
printf("%d", num);
}
return 0;
}
|
main.c: In function 'main':
main.c:6:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'while'
6 | while( scanf("%d", &n) > 0){
| ^~~~~
main.c:13:26: error: 'num' undeclared (first use in this function)
13 | num++;
| ^~~
main.c:13:26: note: each undeclared identifier is reported only once for each function it appears in
|
s160725896
|
p00009
|
C
|
#include <stdio.h>
int main(){
int n,i, j, k,l;
l=0;
scanf("%d",n);
for(i=n;i>2;i--){
for(j=2;j<(n-1);j++){
k=n%j;
if(K==0){return 0;}
else{if(j==n-2){l=l+1;}}
}
}
printf("%d",l);
}
|
main.c: In function 'main':
main.c:11:23: error: 'K' undeclared (first use in this function)
11 | if(K==0){return 0;}
| ^
main.c:11:23: note: each undeclared identifier is reported only once for each function it appears in
|
s473421747
|
p00009
|
C
|
#include <stdio.h>
int main(void){
int n,i, j, k,l;
l=0;
scanf("%d",n);
for(i=n;i>2;i--){
for(j=2;j<(n-1);j++){
k=n%j;
if(K==0){return 0;}
else{if(j==n-2){l=l+1;}}
}
}
printf("%d",l);
}
|
main.c: In function 'main':
main.c:11:23: error: 'K' undeclared (first use in this function)
11 | if(K==0){return 0;}
| ^
main.c:11:23: note: each undeclared identifier is reported only once for each function it appears in
|
s697237500
|
p00009
|
C
|
#include<stdio.h>
int IsPrimeNum(int i){
int j;
if(i==1){
return 0;
}else if(i==2){
return 1;
}
if(i%2==0){
return 0;
}
for(j=3; j<=i/j; j++){
if(i%j==0){
return 0;
}
}
return 1;
}
int primeNum(int n){
int cout = 0, i;
for(i=1; i<=n; i++){
if(IsPrimeNum(i)){
cout += 1;
}
}
return cout;
}
int main(){
int n;
int list[50];
int j = 0;
while(scanf("%d", &n) != EOF){
list[j] = primeNum(n);
j += 1;
}
int i;
for(i=0; i<j; j++)
printf("%d\n", list[iOA]);
return 0;
}
|
main.c: In function 'main':
main.c:42:25: error: 'iOA' undeclared (first use in this function)
42 | printf("%d\n", list[iOA]);
| ^~~
main.c:42:25: note: each undeclared identifier is reported only once for each function it appears in
|
s659644940
|
p00009
|
C
|
int primeNum(int n){
int cout = 0, i;
for(i=1; i<=n; i++){
if(IsPrimeNum(i)){
cout += 1;
}
}
return cout;
}
int main(){
int n;
int list[50];
int j = 0;
while(scanf("%d", &n) != EOF){
list[j] = primeNum(n);
j += 1;
}
int i;
for(i=0; i<j; i++)
printf("%d\n", list[i]);
return 0;
}
|
main.c: In function 'primeNum':
main.c:4:8: error: implicit declaration of function 'IsPrimeNum'; did you mean 'primeNum'? [-Wimplicit-function-declaration]
4 | if(IsPrimeNum(i)){
| ^~~~~~~~~~
| primeNum
main.c: In function 'main':
main.c:15:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
15 | while(scanf("%d", &n) != EOF){
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | int primeNum(int n){
main.c:15:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
15 | while(scanf("%d", &n) != EOF){
| ^~~~~
main.c:15:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:15:28: error: 'EOF' undeclared (first use in this function)
15 | while(scanf("%d", &n) != EOF){
| ^~~
main.c:15:28: note: 'EOF' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
main.c:15:28: note: each undeclared identifier is reported only once for each function it appears in
main.c:21:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
21 | printf("%d\n", list[i]);
| ^~~~~~
main.c:21:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:21:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:21:5: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s221407659
|
p00009
|
C
|
#include <stdio.h>
#include <cmath>
//?找第K小的除数
int main()
{
long long n;
int k;
scanf("%lld%d",&n,&k);
long long d=0,m=0;//第1小是除数是1
int flag=0;
int i=1;
int b=sqrt(n);
for(;i<=b;i++)
{
if(n%i==0)//i是n除数
{
d=i;
m++;
}
if(m==k)
{
printf("%lld\n",d);
flag=1;
break;
}
if(m>k)
break;
}
if(flag==0)
printf("-1\n");
return 0;
}
|
main.c:2:10: fatal error: cmath: No such file or directory
2 | #include <cmath>
| ^~~~~~~
compilation terminated.
|
s828678335
|
p00009
|
C
|
#include<cstdio>
#include<iostream>
#define M 31
int prime(int n);
int main(void)
{
int i,j,t=0,a[M],b[M]={0};
while(scanf("%d",&a[t]))
t++;
for(i=0;i<t;i++)
for(j=2;j<=a[t];j++)
b[i]+=prime(j);
for(i=0;i<t;i++)
printf("%d\n",b[i]);
return 0;
}
int prime(int n)
{
int l;
if(n==2)
return 1;
for(l=2;l<n;l++)
if(n%l==0)
return 0;
return 1;
}
|
main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s010172257
|
p00009
|
C
|
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
typedef long long ll;
bool prime(ll n)
{
ll i;
int flag=0;
if(n==2)
return true;
else if(n<2)
{
return false;
}
else
{
/* if((int)sqrt(n)==sqrt(n))
{
for(i=2;i<(int)sqrt(n)+1&&flag==0;i++)
{
if(n%i==0)
{
return false;
flag=1;
}
}
if(flag==0)
return true;
}
else
{
for(i=2;i<(int)sqrt(n)+1&&flag==0;i++)
{
if(n%i==0)
{
return false;
flag=1;
}
}
if(flag==0)
return true;
}*/
for(i=2;i<(int)sqrt(n)+1&&flag==0;i++)
{
if(n%i==0)
{
return false;
flag=1;
}
}
if(flag==0)
return true;
}
}
int main()
{
ll n;
ll i;
/* while(scanf("%lld",&n)!=EOF)
{
printf("%d\n",prime(n));
}*/
while(scanf("%lld",&n)!=EOF)
{
ll j=0;
for(i=2;i<n+1;i++)
{
if(prime(i))
j++;
}
printf("%lld\n",j);
}
return 0;
}
|
main.c:7:1: error: unknown type name 'bool'
7 | bool prime(ll n)
| ^~~~
main.c:4:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
3 | #include<math.h>
+++ |+#include <stdbool.h>
4 |
main.c: In function 'prime':
main.c:12:24: error: 'true' undeclared (first use in this function)
12 | return true;
| ^~~~
main.c:12:24: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:12:24: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:24: error: 'false' undeclared (first use in this function)
16 | return false;
| ^~~~~
main.c:16:24: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
|
s849536595
|
p00009
|
C
|
#include<cstdio>
#include<cmath>
#define SIZE 1000000
#define sizE 600000
int prime[sizE], nprime=0;
int mark[SIZE];
void sieve()
{
int i,j, limit=sqrt(SIZE*1.0)+2;
mark[0]=1;
mark[1]=1;
for(i=4; i<=SIZE; i+=2)
mark[i]=1;
prime[nprime]=2;
for(i=3; i<=SIZE; i+=2)
{
if(!mark[i])
{
prime[++nprime] = i;
if(i<=limit)
{
for(j=i*i; j<=SIZE; j+=i*2)
mark[j]=1;
}
}
}
}
int main()
{
int n;
sieve();
while(scanf("%d", &n)==1)
{
int i,k;
i=k=0;
while(prime[i++]<=n)
k++;
printf("%d\n", k);
}
return 0;
}
|
main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s311425333
|
p00009
|
C
|
#include<iostream>
using namespace std;
const long N = 1000000;
long prime[N] = {0},num_prime;
int isNotPrime[N] = {1, 1};
int main()
{
int n;
while(cin >> n)
{
num_prime = 0;
for(long i = 2 ; i <= n ; i ++)
{
if(! isNotPrime[i])
prime[num_prime ++]=i;
for(long j = 0 ; j < num_prime && i * prime[j] <= n ; j ++)
{
isNotPrime[i * prime[j]] = 1;
if( !(i % prime[j] ) )
break;
}
}
cout<< num_prime << endl;
}
return 0;
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.