# e339: 前綴和練習 ## [題目連結](https://zerojudge.tw/ShowProblem?problemid=e339) ## 解題想法 * 用兩變數,一個輸入,另一個加上輸入的變數後輸出 ## 遭遇到的困難 * 變數要用long long,輸出要用lld ## 花費的時間:30分鐘 ## 程式碼 ```cpp=01 #include<cstdio> int main(){ long long n,in,tmp=0; scanf("%d",&n); while(n){ scanf("%lld",&in); tmp+=in; printf("%lld ",tmp); n--; } 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