luyencode / comments

Server lưu trữ bình luận trên Luyện Code
https://luyencode.net
6 stars 3 forks source link

https://oj.luyencode.net/problem/MT03 #748

Open utterances-bot opened 2 years ago

utterances-bot commented 2 years ago

Chi tiết bài tập - Luyện Code Online

https://luyencode.net/problem/MT03

danh2006 commented 1 year ago

Đây là lời giải của mình đã AC. Nếu bạn đã cố gắng mà chưa làm được thì có thể tham khảo lời giải của mình.

Xem code AC

#include using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; int a[n][n]; for(int i=0;i> a[i][j]; } } int sum = 0; for(int i=0;i

trung-dixivai commented 1 year ago

include

using namespace std; int main() { int n; cin >> n; int A[100][100]; int tong=0; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { cin >> A[i][j]; } } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if ( i==j){ tong = tong + A[i][j]; } }

}
cout << tong;

}