题解 | #牛牛的平面向量#
牛牛的平面向量
https://www.nowcoder.com/practice/0e0d472d6a30469ab90d8b0aef7f81fe
#include <stdio.h> #include<stdlib.h> struct Vd { int x; int y; }; int main() { int n = 0; scanf("%d", &n); struct Vd* pv = (struct Vd*)malloc(n * sizeof(struct Vd)); for(int i=0;i<n;i++){ scanf("%d %d",&(pv[i].x),&(pv[i].y)); } int sum1=0; int sum2=0; for(int i=0;i<n;i++){ sum1+=pv[i].x; sum2+=pv[i].y; } printf("%d %d",sum1,sum2); free(pv); pv=NULL; return 0; }