bolt
Try our new interface for solving problems
Problems

# Count the number of edges

published at 3/28/22, 6:22:56 pm

# include <iostream>

using ll=long long; using namespace std;

int main() { ll n; cin>>n; ll say=0; ll a[n][n]; for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { cin>>a[i][j]; if(a[i][j]==1) { say++; } } } cout<<say;

return 0;


}

published at 6/22/22, 9:45:35 pm

# include <bits/stdc++.h>

using namespace std; int main(){ vector<int>v; int n; cin>>n; int a[n][n]; for(int i=0; i<n; i++){ for(int j=0; j<n; j++){ cin>>a[i][j]; if(a[i][j]==1) v.push_back(a[i][j]); } } cout<<v.size(); }

published at 9/11/22, 8:06:52 pm

# include<stdio.h>

int main(){ int n,a,count=0; scanf("%d",&n); for(int i=0; i<n*n; i++){ scanf("%d",&a); if(a==true) count++;} printf("%d",count); }

published at 1/6/23, 10:11:06 pm

# include<bits/stdc++.h>

using namespace std; int main() { int n; int say = 0; cin>>n; int g[n+1][n+1]; for(int i = 1 ; i <= n ; i++){ for(int j = 1 ; j <= n ; j++){ cin>>g[i][j]; if(g[i][j] == 1) say++; } } cout<<say; }

published at 12/2/23, 9:22:01 pm

# include<bits/stdc++.h>

using namespace std ; int main() { int n , i , j , count = 0 ; cin >> n ; vector < vector < int > > vec ( n , vector < int > ( n ) ) ; for ( i = 0 ; i < n ; i ++ ) for ( j = 0 ; j < n ; j ++ ) cin >> vec[i][j] ; for ( i = 0 ; i < n ; i ++ ) for ( j = 0 ; j < n ; j ++ ) if( vec[i][j] == 1) count ++ ; cout << count ; return 0 ; }