#include <iostream> #include <algorithm> #include <cmath> using namespace std; int main() { //freopen("acm.acm","r",stdin); int n; int m; int i; double tem; double sum_1 = 0; double sum_2 = 0; cin>>n>>m; for(i = 0; i < n-1; ++ i) { cin>>tem; sum_1 += tem; } for(i = 0; i < m-1; ++ i) { cin>>tem; sum_2 += tem; } sum_1 = sqrt(sum_1*sum_1 + sum_2*sum_2); cout<<ceil(sum_1)<<endl; }
时间: 2024-10-07 21:04:53