1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #include<iostream> using namespace std; int prime(int a) { int i; for(i=2;i<=a/2;i++) { if(a%i==0) return 1; } return 0; } int main() { int i,j,t,a,b; cin>>t; for(i=0;i<t;i++) { cin>>a>>b; j=a; while(j<=b) { if(prime(j)) cout<<j<<endl; } cout<<endl; } return 0; } |
I2luY2x1ZGU8aW9zdHJlYW0+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgcHJpbWUoaW50IGEpCnsKaW50IGk7CmZvcihpPTI7aTw9YS8yO2krKykKewppZihhJWk9PTApCnJldHVybiAxOwp9CnJldHVybiAwOwp9CgppbnQgbWFpbigpCnsKaW50IGksaix0LGEsYjsKY2luPj50Owpmb3IoaT0wO2k8dDtpKyspCnsKY2luPj5hPj5iOwpqPWE7CndoaWxlKGo8PWIpCnsKaWYocHJpbWUoaikpCmNvdXQ8PGo8PGVuZGw7Cn0KY291dDw8ZW5kbDsKfQpyZXR1cm4gMDsKfQ==
-
upload with new input
-
結果: 超過時間限制 time: 5s 記憶體: 2724 kB 信號(Signal): 24 (SIGXCPU)
2 1 10 3 5
-
結果: Success time: 0.01s 記憶體: 2724 kB 回傳值: 0



