#include<bits/stdc++.h> using namespace std; int main(){ int m,n; while(cin>>m>>n){ if(m>n){ int temp=n; n=m; m=temp; } long long sum=0; for(int i=m+1;i<n;++i){ int flag=0; for(int j=2;j<=sqrt(i);++j){ if(i%j==0){ flag=1; break; } } if(flag==0){ sum+=i; } } if(m==0){ sum-=1; } cout<<sum<<endl; } } /* Main.c:1:9: fatal error: bits/stdc++.h: No such file or directory #include<bits/stdc++.h> ^~~~~~~~~~~~~~~ compilation terminated. */ |
Double click to view unformatted code.