#include<bits/stdc++.h>
using namespace std;
int main(){
int a;
while(cin>>a){
int sum=0;
for(int i=1;i<=a;i++){
int b;
cin>>b;
sum+=b*i;
}
cout<<sum<<endl;
}
}
第一句的意義
https://stackoverflow.com/questions/25311011/how-does-include-bits-stdc-h-work-in-c
#include<bits/stdc++.h>
簡單來說是個包含所有c++的#include函數庫
比如:
#include<cmath>
#include<string.h>
#include<string>
等等
#include<bits/stdc++.h>
簡單來說是個包含所有c++的#include函數庫
比如:
#include
#include
#include
等等
以上的程式碼應該只需#include<iostream>就好了
bits/stdc++.h是為了要讓程式設計師不用記太多標頭檔而設計的
#include<bits/stdc++.h>
using namespace std;
int main(){
int a;
while(cin>>a){
int sum=0;
for(int i=1;i<=a;i++){
int b;
cin>>b;
sum+=b*i;
}
cout<<sum<<endl;
}
}
you are ugly
#include<bits/stdc++.h>
using namespace std;
int main(){
int a;
while(cin>>a){
int sum=0;
for(int i=1;i<=a;i++){
int b;
cin>>b;
sum+=b*i;
}
cout<<sum<<endl;
}
}
you are ugly
我很清楚你是程設班的哪一個人
請注意你的言詞