#25664: 解答(C++)


weimolin222@gmail.com (林維摩)

學校 : 屏東市明正國中
編號 : 128544
來源 : [180.176.69.238]
最後登入時間 :
2023-06-03 18:51:30

#include<iostream>

using namespace std;

int main(){

int n;

cin>>n;

if(n<=50){

cout<<n;

}

else{

cout<<n-1;

}

}

#30083: Re: 解答(C++)


yp11031198@yphs.tp.edu.tw (202-24裴逸翔)

學校 : 臺北市私立延平高級中學
編號 : 172060
來源 : [223.136.112.165]
最後登入時間 :
2025-04-10 21:35:01

#include

using namespace std;

int main(){

int n; cin>>n;

if(n<=50){cout<}

else{cout<}

}

本題要求不能用if條件式寫,雖說用if解不會錯,但這樣不就沒有挑戰性了嗎?



#30470: Re: 解答(C++)


gaspardthegenius (gaspard)

學校 : 臺北市私立復興實驗高級中學
編號 : 192216
來源 : [203.204.47.174]
最後登入時間 :
2022-06-06 19:13:19

題目說禁止用IF