1 条题解
-
0
Implement the statement. Iterate from to and use the .find() method in std::string in C++ (or .index() in python) to find the '#' character.
#include <bits/stdc++.h> using namespace std; #define ls u << 1 #define rs u << 1 | 1 #define LL long long #define int long long #define PII pair <int, int> #define fi first #define se second #define pub push_back #define pob pop_back #define puf push_front #define pof pop_front #define lb lower_bound #define ub upper_bound #define i128 __int128 #define pcnt(x) __builtin_popcount(x) #define mem(a,goal) memset(a, (goal), sizeof(a)) #define rep(x,start,end) for(int x = (start) - ((start) > (end)); x != (end) - ((start) > (end)); ((start) < (end) ? x ++ : x --)) #define aLL(x) (x).begin(), (x).end() #define sz(x) (int)(x).size() const int INF = 998244353; const int P = 1e9 + 7; const int N = 1010; char g[N][N]; void solve() { int n; cin >> n; for(int i = 0; i < n; ++ i) { for(int j = 0; j < 4; ++ j) { cin >> g[i][j]; } } for(int i = n - 1; i >= 0; -- i) { for(int j = 3; j >= 0; -- j) { if(g[i][j] == '#') cout << j + 1 << ' '; } } cout << endl; } signed main() { int t; cin >> t; while(t --) solve(); return 0; }
- 1
信息
- ID
- 5470
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 10
- 标签
- (无)
- 递交数
- 4
- 已通过
- 3
- 上传者