From b18a408a2c4da34711d226d21b4f75559affadd9 Mon Sep 17 00:00:00 2001 From: Oliver Lew Date: Sat, 2 Jun 2018 19:00:10 +0800 Subject: [PATCH] simplify read process using the return value of scanf --- PATAdvanced/1015.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/PATAdvanced/1015.c b/PATAdvanced/1015.c index 12816e3..f126b3c 100644 --- a/PATAdvanced/1015.c +++ b/PATAdvanced/1015.c @@ -56,13 +56,9 @@ int Rev(int N, int D) int main() { int N, D; - scanf("%d", &N); - while(N >= 0) - { - scanf("%d", &D); + + while(scanf("%d %d", &N, &D) == 2) puts(iPrime(N) && iPrime(Rev(N, D)) ? "Yes" : "No"); - scanf("%d", &N); - } - + return 0; }