zoukankan      html  css  js  c++  java
  • Daliy Algorithm (推理,贪心)-- day 65

    Nothing to fear

    those times when you get up early and you work hard; those times when you stay up late and you work hard; those times when don’t feel like working — you’re too tired, you don’t want to push yourself — but you do it anyway. That is actually the dream. That’s the dream. It’s not the destination, it’s the journey. And if you guys can understand that, what you’ll see happen is that you won’t accomplish your dreams, your dreams won’t come true, something greater will. mamba out


    那些你早出晚归付出的刻苦努力,你不想训练,当你觉的太累了但还是要咬牙坚持的时候,那就是在追逐梦想,不要在意终点有什么,要享受路途的过程,或许你不能成就梦想,但一定会有更伟大的事情随之而来。 mamba out~

    2020.4.24


    Kind Anton

    一共存在三种可以判定的情况
    如果当前 a[i] = b[i] continue
    如果当前 a[i] < b[i] 但是 a[1-i-1] 不存在 1 错误
    如果当前 a[i] > b[i] 但是 a[1-i-1] 不存在 -1 错误
    否则满足要求

    #include <iostream>
    #include <cstdio>
    #include <algorithm>
    #include <cstdlib>
    #include <cstring>
    #include <vector>
    #include <cassert>
    #include <string>
    #include <cmath>
    #define SIS std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    #define lowbit(x) (x & -x)
    using namespace std;
    typedef long long ll;
    const int N = 100005;
    const int MAX = 0x7ffffff;
    int t;
    
    void slove()
    {
    	int n;
    	cin >> n;
    	int a[N] , b[N];
    	for(int i = 0;i < n ;i ++)cin >> a[i];
    	for(int i = 0;i < n ;i ++)cin >> b[i];
    	vector<int> good(2, 0);
        for (int i = 0; i < n; ++i) {
            if (a[i] > b[i] && !good[0]) {
                cout << "NO
    ";
                return;
            } else if (a[i] < b[i] && !good[1]) {
                cout << "NO
    ";
                return;
            }
            if (a[i] == -1) good[0] = 1;
            if (a[i] == 1) good[1] = 1;
        }
        cout << "YES
    ";
    	return;
    }
    int main()
    {
    	SIS;
    	cin >> t;
    	while(t--)
    	{
    		slove();
    	}
    }
    

    Little Artem

    感觉像是在做阅读理解

    #include <iostream>
    #include <cstdio>
    #include <algorithm>
    #include <cstdlib>
    #include <cstring>
    #include <vector>
    #include <cassert>
    #include <string>
    #include <cmath>
    #define SIS std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    #define lowbit(x) (x & -x)
    using namespace std;
    typedef long long ll;
    const int MAX = 0x7ffffff;
    int t;
    
    void slove()
    {
    	int n , m;
    	cin >> n >> m;
    	for(int i = 1;i <= n ;i ++)
    	{
    		for(int j = 1;j <= m ;j ++)
    		{
    			if(i == 1 && j == 1)cout << "W";
    			else cout << "B"; 
    		}
    		cout << endl;
    	}
    }
    int main()
    {
    	SIS;
    	cin >> t;
    	while(t--)
    	{
    		slove();
    	}
    }
    
  • 相关阅读:
    泛微云桥e-Bridge 目录遍历,任意文件读取
    (CVE-2020-8209)XenMobile-控制台存在任意文件读取漏洞
    selenium 使用初
    将HTML文件转换为MD文件
    Python对word文档进行操作
    使用java安装jar包出错,提示不是有效的JDK java主目录
    Windows server 2012安装VM tools异常解决办法
    ifconfig 命令,改变主机名,改DNS hosts、关闭selinux firewalld netfilter 、防火墙iptables规则
    iostat iotop 查看硬盘的读写、 free 查看内存的命令 、netstat 命令查看网络、tcpdump 命令
    使用w uptime vmstat top sar nload 等命令查看系统负载
  • 原文地址:https://www.cnblogs.com/wlw-x/p/12771011.html
Copyright © 2011-2022 走看看