#include<stdio.h> bool sushu(int m){ for(int i=2;i<(m/2+1);i++){ if(m%i==0){ return false; } } return true; } int main(){ int sh,sm,eh,em,s,e,n,i,j,H,M; while(scanf("%d:%d %d:%d",&sh,&sm,&eh,&em)!=EOF){ n=0; s=sh*60+sm; e=eh*60+em; for(i=s;s<=e;s++){ H=s/60; M=s%60; if(sushu(H*2500+M)){ n++; } } printf("%d\n",n); } } /* Main.c:2:1: error: unknown type name 'bool' bool sushu(int m){ ^ Main.c: In function 'sushu': Main.c:5:11: error: 'false' undeclared (first use in this function) return false; ^ Main.c:5:11: note: each undeclared identifier is reported only once for each function it appears in Main.c:8:9: error: 'true' undeclared (first use in this function) return true; ^ Main.c: In function 'main': Main.c:11:26: warning: unused variable 'j' [-Wunused-variable] int sh,sm,eh,em,s,e,n,i,j,H,M; ^ Main.c:11:24: warning: variable 'i' set but not used [-Wunused-but-set-variable] int sh,sm,eh,em,s,e,n,i,j,H,M; ^ Main.c: In function 'sushu': Main.c:9:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ */ |
Double click to view unformatted code.