library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub beet-aizu/library

:heavy_check_mark: test/aoj/ALDS1_1_C.test.cpp

Depends on

Code

// verification-helper: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_C

#include<bits/stdc++.h>
using namespace std;

#define call_from_test
#include "../../math/isprime.cpp"
#undef call_from_test

signed main(){
  int n;
  cin>>n;
  int ans=0;
  for(int i=0;i<n;i++){
    int x;
    cin>>x;
    ans+=isprime(x);
  }
  cout<<ans<<endl;
  return 0;
}
#line 1 "test/aoj/ALDS1_1_C.test.cpp"
// verification-helper: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_C

#include<bits/stdc++.h>
using namespace std;

#define call_from_test
#line 1 "math/isprime.cpp"

#line 3 "math/isprime.cpp"
using namespace std;
#endif
//BEGIN CUT HERE
template<typename T>
int isprime(T x){
  if(x<=1) return 0;
  for(T i=2;i*i<=x;i++)
    if(x%i==0) return 0;
  return 1;
}
//END CUT HERE
#ifndef call_from_test
signed main(){
  return 0;
}
#endif
#line 8 "test/aoj/ALDS1_1_C.test.cpp"
#undef call_from_test

signed main(){
  int n;
  cin>>n;
  int ans=0;
  for(int i=0;i<n;i++){
    int x;
    cin>>x;
    ans+=isprime(x);
  }
  cout<<ans<<endl;
  return 0;
}
Back to top page