제출 #1128713

#제출 시각아이디문제언어결과실행 시간메모리
1128713raiselBomb (IZhO17_bomb)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
#define forn for(int i=1;i<=n;i++)
#define Yes cout<<"YES\n"
#define No cout<<"NO\n"
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define pb push_back
#define sp setprecision
#define int long long
#define ll long long
#define nn '\n'
using namespace std;
const int N=2502;
const int MOD=1e9+7;    
char a[N][N];
string ab="abcdefghijklmnopqrstuvwxyz";
int binpow(int n, int k) {
    int ans = 1;
    while (k > 0) {
        if (k % 2 == 1) {
            ans = (ans * n) % MOD;
        }
        n = (n * n) % MOD;
        k /= 2;
    }
    return ans;
}
int n,m;
string s;
void al(){
  cin>>n>>m;
  for(int i=1;i<=n;i++){
    for(int j=1;j<=m;j++){
      cin>>a[i][j];
    }
  }
  int cnt=0;
  vector<int>v;
  for(int i=1;i<=n;i++){
    for(int j=1;j<=m;j++){
      if(a[i][j]=='1') cnt++;
       else {
         if(cnt>0) v.pb(cnt);
         cnt=0;
       }
    }
  }
  int x=v[0];
  for(auto i:v){
    int g=__gcd(x,i);
    x=g;
  }
  cout<<x;
}

signed main(){
  freopen("bomb.in","r",stdin);
    freopen("bomb.out","w",stdout);
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);  
  int t=1;
//  cin>>t;  
  while(t--) {
    al();
    }  
    }  
//    x!
//    3! (x-3)!;
/*
2
1 1 1 1 1 1 
1 2 3 4 5 6
1 2 3
1 2 4
1 2 5
1 2 6
1 3 4
1 3 5
1 3 6
1 4 5
1 4 6
1 5 

컴파일 시 표준 에러 (stderr) 메시지

bomb.cpp:71:1: error: unterminated comment
   71 | /*
      | ^
bomb.cpp: In function 'int main()':
bomb.cpp:59:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   59 |   freopen("bomb.in","r",stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
bomb.cpp:60:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   60 |     freopen("bomb.out","w",stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~