Skip to content

Commit fce56ad

Browse files
committed
solved 24533
1 parent 80db972 commit fce56ad

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

24000/24533/24533.cpp

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
typedef long long ll;
5+
6+
#define FOR(i, a, b) for (int i = a; i < b; i++)
7+
int N;
8+
ll a, b, c, d, ans=0;
9+
10+
// energy generation satisfies commutivity and associativity
11+
int main() {
12+
ios::sync_with_stdio(false); cin.tie(NULL);
13+
cin>>N;
14+
cin>>a>>b;
15+
FOR(i, 1, N){
16+
cin>>c>>d;
17+
ans += a*d+b*c;
18+
a+=c;
19+
b+=d;
20+
}
21+
22+
cout<<ans;
23+
24+
return 0;
25+
}

0 commit comments

Comments
 (0)