알고리즘 💻/과제

    공통과제 3번 <Good Matrix>

    // // Copyright (c) 2021 HyeJin Shin All rights reserved. // #include #include using namespace std; int arr[300][300]; vector v; int main() { ios_base::sync_with_stdio(false); cin.tie(0); freopen("matrix.inp","r",stdin); freopen("matrix.out","w",stdout); int T; int N=0; cin >> T; while(T--){ if(N!=0){ //N이 0이 아니면(배열에 값을 받은 적이 있다면) arr배열을 초기화 해준다. for(int i=0;i> N; for(int i=0;i arr[i][k]; if(arr..

    공통과제 2번 <격자에서 걷기 1>

    // // Copyright (c) 2021 HyeJin Shin All rights reserved. // #include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); freopen("grid1.inp","r",stdin); freopen("grid2.out","w",stdout); int T; int N, M; int t,s,k; cin >>T; while(T--){ cin >>N>>M>>t>>s>>k; if(t==1){ //타입 1 : {좌상,우상} {우하,좌하}가 짝을 이룸 int d = (k-1)/M; //d는 1행, 2행, 3행과 같은 행을 나타냄. if(s==1){ //좌상 if(d%2==0)c..

    공통과제 1번 <그릇>

    // // Copyright (c) 2021 HyeJin Shin All rights reserved. // #include #include #include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); freopen("dish.inp","r",stdin); freopen("dish.out","w",stdout); int T; int n; string s; cin>>T; while(T--){ int cnt=10; cin >> n; cin>>s; for(int i=1;i