#include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; while (n--){ int a; cin>>a; bool isPrime=true; // 設立一個布林值判斷它是否是質數(並且預設為true) if (a<2){ // 如果輸入的數字小於2,則不是質數 isPrime=false; } else{ for(int i=2;i*i<=a;i++){ // 從2開始,到a的平方根,每次加1 if (a%i==0){ // 如果a能被i整除,則不是質數 isPrime=false; // 將isPrime設為false break; } } } if (isPrime) // 如果isPrime為true,則輸出Y cout<<"Y"<<endl; else // 如果isPrime為false,則輸出N cout<<"N"<<endl; } return 0; }
yeah I don't know what im typing about