# e835: 表演座位 ## [題目連結](https://zerojudge.tw/ShowProblem?problemid=e835) ## 解題想法 * 把三個區域分開討論,求出位置 ## 遭遇到的困難 * 要注意能被每排座位數整除的情況(25和50) * 二、三區要先扣除前面的座位數 ## 花費的時間:10分鐘 ## 程式碼 ```cpp=01 #include<cstdio> int main(){ int n; scanf("%d",&n); int a,b,c; if(n<=2500){ a=1; b=n/25; c=n%25; if(c==0){ c=25; b-=1; } } else if(n<=7500){ a=2; n-=2500; b=n/50; c=n%50; if(c==0){ c=50; b-=1; } } else{ a=3; n-=7500; b=n/25; c=n%25; if(c==0){ c=25; b-=1; } } printf("%d %d %d",a,b+1,c); return 0; }
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up