• ASC7 Problem A. Nonoptimal Assignments


    题目大意

    构造一个矩阵使得一个贪心算法失效

    简要题解

    傻缺题

     1 #include <bits/stdc++.h>
     2 using namespace std;
     3 namespace my_header {
     4 #define pb push_back
     5 #define mp make_pair
     6 #define pir pair<int, int>
     7 #define vec vector<int>
     8 #define pc putchar
     9 #define clr(t) memset(t, 0, sizeof t)
    10 #define pse(t, v) memset(t, v, sizeof t)
    11 #define bl puts("")
    12 #define wn(x) wr(x), bl
    13 #define ws(x) wr(x), pc(' ')
    14     const int INF = 0x3f3f3f3f;
    15     typedef long long LL;
    16     typedef double DB;
    17     inline char gchar() {
    18         char ret = getchar();
    19         for(; (ret == '
    ' || ret == '
    ' || ret == ' ') && ret != EOF; ret = getchar());
    20         return ret; }
    21     template<class T> inline void fr(T &ret, char c = ' ', int flg = 1) {
    22         for(c = getchar(); (c < '0' || '9' < c) && c != '-'; c = getchar());
    23         if (c == '-') { flg = -1; c = getchar(); }
    24         for(ret = 0; '0' <= c && c <= '9'; c = getchar())
    25             ret = ret * 10 + c - '0';
    26         ret = ret * flg; }
    27     inline int fr() { int t; fr(t); return t; }
    28     template<class T> inline void fr(T&a, T&b) { fr(a), fr(b); }
    29     template<class T> inline void fr(T&a, T&b, T&c) { fr(a), fr(b), fr(c); }
    30     template<class T> inline char wr(T a, int b = 10, bool p = 1) {
    31         return a < 0 ? pc('-'), wr(-a, b, 0) : (a == 0 ? (p ? pc('0') : p) : 
    32             (wr(a/b, b, 0), pc('0' + a % b)));
    33     }
    34     template<class T> inline void wt(T a) { wn(a); }
    35     template<class T> inline void wt(T a, T b) { ws(a), wn(b); }
    36     template<class T> inline void wt(T a, T b, T c) { ws(a), ws(b), wn(c); }
    37     template<class T> inline void wt(T a, T b, T c, T d) { ws(a), ws(b), ws(c), wn(d); }
    38     template<class T> inline T gcd(T a, T b) {
    39         return b == 0 ? a : gcd(b, a % b); }
    40     template<class T> inline T fpw(T b, T i, T _m, T r = 1) {
    41         for(; i; i >>= 1, b = b * b % _m)
    42             if(i & 1) r = r * b % _m;
    43         return r; }
    44 };
    45 using namespace my_header;
    46 
    47 
    48 int main() {
    49     freopen("assign.in", "r", stdin);
    50     freopen("assign.out", "w", stdout);
    51 
    52     int n;
    53     fr(n);
    54     ws(1);
    55     for (int i = 2; i <= n; ++i)
    56         ws(2);
    57     bl;
    58     for (int i = 2; i <= n; ++i) {
    59         ws(1);
    60         for (int j = 2; j <= n; ++j)
    61             ws(100);
    62         bl;
    63     }
    64 
    65     return 0;
    66 }
  • 相关阅读:
    OpenCV 笔记 (C++模板template)
    C++中预定义的运算符的操作对象只能是基本的数据类型
    linux-CentOS6.4下安装oracle11g详解
    Eclipse 连接MySql数据库总结
    六个创建模式之单例模式(Singleton Pattern)
    六个创建模式之抽象工厂模式(Abstract Factory Pattern)
    六个创建模式之工厂方法模式(Factory Method Pattern)
    六个创建模式之简单工厂模式(Simple Factory Pattern)
    搜狗实习面试
    Java设计模式 -- 基本原则
  • 原文地址:https://www.cnblogs.com/ichn/p/6403712.html
Copyright © 2020-2023  润新知