ICode9

精准搜索请尝试: 精确搜索
  • 1351统计矩阵中的负数个数2022-05-07 12:00:11

    title: 1351.统计有序矩阵中的负数

  • 1351. Count Negative Numbers in a Sorted Matrix2022-01-20 04:31:08

    这道题的最简单的算法如下,时间复杂度O(m*n) public int countNegatives(int[][] grid) { int res = 0; for(int i=0;i<grid.length;i++){ for ( int j=0;j<grid[0].length;j++){ if(grid[i][j]<0) res ++;

  • 拓扑排序 模板 信息学一本通1351:【例4-12】家谱树2021-12-18 17:03:25

        1 #include<bits/stdc++.h> 2 using namespace std; 3 const int N=105; 4 int n; 5 int in[N]; 6 vector<int>G[N]; 7 int main() 8 { 9 scanf("%d",&n); 10 queue<int>q; 11 for(int i=1;i<=n;i++) 12 {

  • 1351. 密码锁【难度: 一般 / 知识点: 枚举 容斥原理】2021-11-05 13:58:00

    https://www.acwing.com/problem/content/1353/ 暴力枚举: #include<bits/stdc++.h> using namespace std; int a,b,c,a1,b1,c1,n,cnt; bool f(int a,int b) { for(int i=0;i<=2;i++) { int temp1=a+i;//向前转动 if(temp1>n) temp1=temp1%n;

  • 1351. 密码锁2021-05-02 19:03:30

    最裸的暴力,时间复杂度:\(O(n^3)\)。 const int N=110; int a[3],b[3]; int n; bool check(int c[],int a[]) { for(int i=0;i<3;i++) if(abs(a[i]-c[i]) > 2 && abs(a[i]-c[i]) < n-2) return false; return true; } int main() {

  • C++一本通:1351——家谱树2021-04-10 15:35:03

    题目来自:http://ybt.ssoier.cn:8088/problem_show.php?pid=1351 【题目描述】 有个人的家族很大,辈分关系很混乱,请你帮整理一下这种关系。 给出每个人的孩子的信息。 输出一个序列,使得每个人的后辈都比那个人后列出。 【输入】 第1行一个整数NN(1≤N≤1001≤N≤100),表示家族的人数

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有