素數判定 (hdu2012)

2021-08-20 15:37:04 字數 465 閱讀 4662

problem description

對於表示式n^2+n+41,當n在(x,y)範圍內取整數值時(包括x,y)(-39<=x

input

輸入資料有多組,每組佔一行,由兩個整數x,y組成,當x=0,y=0時,表示輸入結束,該行不做處理。

output

對於每個給定範圍內的取值,如果表示式的值都為素數,則輸出"ok",否則請輸出「sorry」,每組輸出佔一行。

sample input

0 10 0

sample output

ok

**:

#include#includeint main()

if(flag == 1)

}if(c == 0)

printf("ok\n");

}}

HDU 2012 素數判定

problem description 對於表示式n 2 n 41,當n在 x,y 範圍內取整數值時 包括x,y 39 x input 輸入資料有多組,每組佔一行,由兩個整數x,y組成,當x 0,y 0時,表示輸入結束,該行不做處理。output 對於每個給定範圍內的取值,如果表示式的值都為素數,則...

hdu 2012 素數判定

problem description 對於表示式n 2 n 41,當n在 x,y 範圍內取整數值時 包括x,y 39 x input 輸入資料有多組,每組佔一行,由兩個整數x,y組成,當x 0,y 0時,表示輸入結束,該行不做處理。output 對於每個給定範圍內的取值,如果表示式的值都為素數,則...

hdu 2012 素數判定

problem description 對於表示式n 2 n 41,當n在 x,y 範圍內取整數值時 包括x,y 39 x input 輸入資料有多組,每組佔一行,由兩個整數x,y組成,當x 0,y 0時,表示輸入結束,該行不做處理。output 對於每個給定範圍內的取值,如果表示式的值都為素數,則...