首页 > 其他分享 >match's mistake-2

match's mistake-2

时间:2023-01-19 15:55:19浏览次数:63  
标签:oo ch cout int 水滴 pa match mistake

Get Your Wish

(https://www.luogu.com.cn/problem/P7262)

一个模拟题

解读一下题目:简单来说就是在现在重力的方向上,如果有水滴和电子元件就GG,否则就OK

这里要注意一点,(卡死我这一点,水滴可能不止一滴。

方法:简单判断是否水滴和电子元件处于重力的方向上就好

Acode

 int n,m; cin >> n >> m;
    char begin; cin >> begin;
    vector<pair<int,int>> pa,oo;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            char ch; cin >> ch;
            if(ch == 'o'){
                oo.push_back({i,j});
            }
            if(ch == 'x')pa.push_back({i,j});
        }
    }
    if(!oo.size() || !pa.size())cout << "OK" << endl;
    else{
        for (int i = 0; i < oo.size(); i++) {
            int x = oo[i].first,y = oo[i].second;
            for (int j = 0; j < pa.size(); j++) {
                if(begin == 'v'){
                    if(pa[j].second == y){
                        if(x < pa[j].first){
                            cout << "GG" << endl;
                            exit(0);
                        }
                    }
                }else if(begin == '^'){
                    if(pa[j].second == y){
                        if(x > pa[j].first){
                            cout << "GG" << endl;
                            exit(0);
                        }
                    }
                }else if(begin == '>'){
                    if(pa[j].first == x){
                        if(y < pa[j].second){
                            cout << "GG" << endl;
                            exit(0);
                        }
                    }
                }else if(begin == '<'){
                    if(pa[j].first == x){
                        if(y > pa[j].second){
                            cout << "GG" << endl;
                            exit(0);
                        }
                    }
                }
            }
        }
        cout << "OK" << endl;
    }

标签:oo,ch,cout,int,水滴,pa,match,mistake
From: https://www.cnblogs.com/TFOREVERY/p/17061664.html

相关文章

  • match's mistake
    Survivor(https://codeforces.com/group/L9GOcnr1dm/contest/422378/problem/F)血的教训比较有意思的一个贪心题简单翻译一下题目:输入第一行n,m,k;分别代表有几个人,几......
  • 【nvidia-smi】Failed to initialize NVML: Driver/library version mismatch解决方法
      解决:    https://blog.csdn.net/private_void_main/article/details/128014317 ......
  • Matrix Matcher
    MatrixMatcher代码#include<bits/stdc++.h>usingnamespacestd;constintM=1005;usingull=unsignedlonglong;constullP1=131,P2=233;strings1[M],s2[M];......
  • LeetCode Top 100 Liked Questions 10.Regular Expression Matching (Java版; Hard)
    ​​welcometomyblog​​LeetCodeTop100LikedQuestions10.RegularExpressionMatching(Java版;Hard)题目描述Givenaninputstring(s)andapattern(p),im......
  • RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at no
    报错RuntimeError:张量a的大小必须与张量b在非单例维度0上的大小匹配换言之:通道数不同,本代码中使用png图片(四通道图片)png图片比jpg多了一个Alpha通道,一个RGB颜色模型......
  • match's mistake-5
    狠狠地切割(HardVersion)(https://www.luogu.com.cn/problem/P8889)跟easy版非常像,但是数据太大开标记数组的话会爆所.以得转换一下开一个map<longlong,int>作为标记就......
  • match's mistake-4
    翻硬币(https://www.luogu.com.cn/problem/P8597)说实话第一眼看过去的时候我就想复杂了,然后冥思苦想好久都没结果到结束后再回来想想最小次数,那就说明每个硬币最多只能翻......
  • match's mistake - 3
    等差数列(https://www.luogu.com.cn/problem/P8682)第一眼下去,好简单,结果交上去一个t,三个wa,还是不能小看蓝桥杯的模拟的废话不多说,开始解读题目首先题目很容易理解,给定一......
  • 迁移学习(MixMatch)《MixMatch: A Holistic Approach to Semi-Supervised Learning》
    论文信息论文标题:MixMatch:AHolisticApproachtoSemi-SupervisedLearning论文作者:DavidBerthelot,NicholasCarlini,IanGoodfellow,NicolasPapernot,Avital......
  • match's mistake-3
    乘法表(https://www.luogu.com.cn/problem/P8723)小题一道但是得注意几点1.给定的数据范围不存在第三位数2.不只是结果大于十的得转化字母乘法中的也要转化(如1010=91应......