From f3750b28514920058ccef71e53c0c4cc5981a8a5 Mon Sep 17 00:00:00 2001 From: flykhan Date: Sat, 24 Jun 2023 10:43:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3:=20=E6=96=90=E6=B3=A2?= =?UTF-8?q?=E9=82=A3=E5=A5=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- day7/homework/oh3.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/day7/homework/oh3.cpp b/day7/homework/oh3.cpp index 8072471..14d22d4 100644 --- a/day7/homework/oh3.cpp +++ b/day7/homework/oh3.cpp @@ -13,8 +13,13 @@ int main() int a = 1; int b = 1; int c = 0; - cout << a << "\t" << b << "\t"; - while (c <= n) + + if (n >= 1) + cout << a << "\t"; + if (n >= 2) + cout << b << "\t"; + + while (n > 2 && c <= n) { c = a + b; if (c <= n)