ID
Code : -
Code : -
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | /**************************************** @_@ Cat Got Bored *_* #_# *****************************************/ #include <bits/stdc++.h> #define loop(i,s,e) for(int i = s;i<=e;i++) //including end point #define pb(a) push_back(a) #define sqr(x) ((x)*(x)) #define CIN ios_base::sync_with_stdio(0); cin.tie(0); #define ll long long #define ull unsigned long long #define SZ(a) int(a.size()) #define read() freopen("input.txt", "r", stdin) #define write() freopen("output.txt", "w", stdout) #define ms(a,b) memset(a, b, sizeof(a)) #define all(v) v.begin(), v.end() #define PI acos(-1.0) #define pf printf #define sfi(a) scanf("%d",&a); #define sfii(a,b) scanf("%d %d",&a,&b); #define sfl(a) scanf("%lld",&a); #define sfll(a,b) scanf("%lld %lld",&a,&b); #define mp make_pair #define paii pair<int, int> #define padd pair<dd, dd> #define pall pair<ll, ll> #define fs first #define sc second #define CASE(t) printf("Case %d: ",++t) // t initialized 0 #define INF 1000000000 //10e9 #define EPS 1e-9 using namespace std; int arr[7][7]; int main() { loop(r,1,6) loop(c,1,6) cin>>arr[r][c]; int mx_r,mx_c; int mx = -9999; loop(r,1,6) { loop(c,1,6) { if(r!=1 && r!=6 && c!=1 && c!=6) { int sum = arr[r-1][c-1] + arr[r-1][c] + arr[r-1][c+1] + arr[r+1][c-1] + arr[r+1][c] + arr[r+1][c+1] +arr[r][c]; if(sum>=mx) { mx = sum; mx_r = r; mx_c = c; } } } } int r = mx_r;int c = mx_c; //cout<<arr[r-1][c-1] <<" "<< arr[r-1][c] <<" "<< arr[r-1][c+1]<<endl; //cout<<" "<<arr[r][c]<<" "<<endl; //cout<<arr[r+1][c-1] <<" "<< arr[r+1][c] <<" "<< arr[r+1][c+1]<<endl; //cout<<mx<<endl; return 0; } |
No comments:
Post a Comment