• 3.16


    原题链接

    题意

    就是给你一个R*C的矩阵的然后使得每一行和每一列的GCD都不一样, 且最大的GCD是最小的

    思路

    一开始我以为只要R 或者 C 大于29(因为(2^{29} > 10 ^{9})
    然后我发现规律不是这个,通过RLS的一张图我明白这题如何构造
    avatar
    就是列从1到C 然后 行从 c+1到n 也可以反过来。

    代码

    ///*
    //正在播放《フリージア》
    //1:21  ━━━━━━●─────   5:35
    //   ?   ?   ??   ?   ?
    //```````'`...```````''`````````````'````````````````'`.`''
    //```````''..`';;'```''```'''''''''''''`````````````````'':
    //.````''''':;;!!:````'````'''''''''''``````````````````'':
    //``''''''':;;;;;'```'``````''```````````____________```'':
    //`````````:;;!;'```````````'```````'```|   所以说   |'``'':
    //```````'|$&$%:````````````'```````````|不要停下来啊|''''':
    //````'''!$&&&|'```````````'''::''::''''/ (指AC)  |':'':::
    //````'':|&&&$!'`````'''''''::.....`;!;'/_________|''``'::
    //  ....'|&&@$!'........```:!;'....`:;:```````````````````'
    //..````;$&&&$!:''``````'':|%%!::;|%$$!::::::::''::::::::::
    //``````!&&@&&|:'````````':|$$$$$$$$$|:':::::::::::::::::::
    //`````:%&@@@@@@@@&&&@@@@&&&&@@@@@@@&&&|::::::::':::::::::;
    //`````.```':|$@@@@@@@@@@@@@@@@@@@@@@@@###@@&&$|;:::'::::::
    //````````````';|$&@@@@@@@@@###@@@@@@########@@@@$!''''::::
    //`````````..````:|%$@@@@@#########@#########@@@@&!''''::::
    //`````````````````:|&########################@@@$;::::::::
    //``````````````````:!$@########################@%;:::'::::
    //``````````..``````':|&#######################@@&!''''''::
    //''''::'''`.`''''''':|@#######################@@&|:'`.`';!
    //:::::::::``'''''';%@######################@@##@@&!::'';;;
    //::;::::::`.''''';%@@@@####################$%@##@@%;:'':;!
    //:;;;;::::``':;%@@@#########################&%&##@@|:'';;!
    //;;!;;;;;;'`::;%@#############################@@##@$!'';!!
    //;;;;;;;;:``':::::;|$@############################@$!'`;!!
    //::;;;;;;:'`'::::::;!$@#######################&&@$$$;``:;;
    //`````````..````````'|@#####################$;!$$$&@@|''':
    //'''''''''''''':'''''|@#########@&@##########@@####@@&%|!!
    //''''''''':'''::'':''!&########&!|&@##########&&####&%|!||
    //:::::'''::::::::::::!&########|:;|$@#########@&###&%||||!
    //:::::::'''''':::::::!&#######@!:;!!$@########@$&##@%||||!
    //
    //                    だからよ...止まるじゃねえぞ
    // */
    //
    
    
    
    
    #include <vector>
    #include <algorithm>
    #include <string>
    #include<cstring>
    #include <iostream>
    #include <set>
    #include <map>
    #include <stack>
    #include <queue>
    #include <unordered_map>
    #include <bitset>
    #include <cassert>
    #include <chrono>
    #include <random>
    #include <iomanip>
    #include <unordered_set>
    #include <ctime>
    #include <chrono>
    using namespace std;
    // #define  ll long long
    const int N =1e5+10;
    
    #define all(x) (x).begin(),(x).end()
    #define rall(x) (x).rbegin(),(x).rend()
    #define pb push_back
    #define sz(x) (int)(x).size()
    typedef long long ll;
    typedef long double ld;
    mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
    ll n , m ,t ;
    int f[1000010],br[2000010];
    int s[2010][1010]={0};
    bool st[N];
    
    ll mod = 1e9+7;
    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0), cout.tie(0);
    	cin >>n>>m;
    	if(m==n && m ==1 ) return cout<<0<<endl, 0;
    	else if(n==1&&m!=1|| m==1 &&n!=1) {
    		int	cnt =2;
    		for(int i=1 ;i<=n;i++){
    			for(int j=1 ;j<=m;j++)s[i][j] = cnt++;
    		}
    	}
    	else {
    		for(int i=1;i<=n;i++){
    			s[i][1] =(i+m);
    			for(int j=1 ;j<=m;j++){
    				if(i ==1 ){
    					s[i][j]=s[i][1]*j;
    				}
    				else if(j!=1&&i!=1){
    					s[i][j] =s[i][1]*j;
    				}
    			}
    		}
    	}	for(int i=1;i<=n;i++){
    			for(int j=1;j<=m;j++)cout<<s[i][j]<<" ";cout<<endl;
    		}
        return 0;
    
    }
    /*
     * 5
    4 100
    0 0 0 0
    1 2
    1
    3 4
    1 4 1
    3 2
    0 1 3
    3 9
    0 59049 810
    */
    
  • 相关阅读:
    blog网页模版
    Sidebyside assembly
    几种hash算法
    [软件调试学习笔记]防止栈缓冲区溢出的基于Cookie的安全检查机制
    erlang注意(经典)
    erlang 的源代码保护机制(经典)
    erlang 的源代码保护机制(经典)
    java反编译工具jad
    erlang注意(经典)
    java反编译工具jad
  • 原文地址:https://www.cnblogs.com/gaohaoy/p/12508007.html
Copyright © 2020-2023  润新知