View Code of Problem 51

#include "stdlib.h"
#include "algorithm"
#include "iostream"
#include <cstdio>
#include "string"
#include <iomanip>
#include <map>
#include <set>
#include "math.h"
using namespace std;
map<int, bool> mp;
set<string> st;


int main()
{
	int n; cin >> n; int x[11][11];
	int sum = 0;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			cin >> x[i][j];
			if (j <= i)sum += x[i][j];
		}
	}
	cout << sum;
	return 0;
}

Double click to view unformatted code.


Back to problem 51