ICode9

精准搜索请尝试: 精确搜索
  • ccf:201412 - 02 Z字型扫描 (解题思路 + 满分代码)2022-01-22 13:00:10

    题目描述 解题思路 方法一:铁头模拟题目中那个路线的规律,记录上一步是怎么走的,判断下一步该如何走(例如:上一步是横,下一步是左上或右下;上一步是左下,下一步是左下或下或横)用if判断下一步该如何走,这种方法我试过,可解,只是稍微有些繁琐 方法二:寻找更一般的规律 以4 x 4的矩阵为例

  • 201412-2 Z字形扫描2021-08-07 15:32:10

    文章目录 C++总结 本题链接:201412-2 Z字形扫描 本博客给出本题截图: C++ #include <iostream> using namespace std; const int N = 510; int g[N][N]; int main() { int n; cin >> n; for (int i = 1; i <= n; i ++ ) for (int j = 1; j <=

  • 201412-2 Z字形扫描2020-12-07 18:01:21

    Z字形扫描 201412-2代码 201412-2 语言:C++ 分数:100 代码 #include <iostream> using namespace std; int a[500][500]; int main() { int N; cin>>N; int i,j; for(i=0;i<N;i++) for(j=0;j<N;j++) cin>>a[i][j]; int dir=-1;//dir

  • 201412-2 z字形扫描2020-03-15 21:06:53

    题目描述 解题思路 #include<iostream> using namespace std; int a[500][500]; int converse(int a[],int n) { int temp; for(int i=0,j=n-1;i<j;i++,j--) { int temp; temp=a[i]; a[i]=a[j]; a[j]=temp; } } int main() { int n; cin>>n; int b[

  • [CCF CSP]201412-2 Z字形扫描2020-03-13 18:52:55

    这题是稍微复杂一点的小模拟,细节有点多(本人比较烦此类题目,耗时较久,算是偏难的CSP-2了 我采用的解决办法是,将方向表示为状态,(感觉这种方法比较适合这类题) 其次,画状态转移图(包含状态转移条件和执行语句,这一步需要细心 然后,根据状态转移图快速编写好程序 最后,验证样例和特殊数据(一开始

  • CCF-CSP题解 201412-4 最优灌溉2019-12-13 16:00:43

    \(kruskal\),有兴趣\(heap\_prim\)。 #include <bits/stdc++.h> using namespace std; struct tEdge { int a, b, c; bool operator < (const tEdge &y) const { return c < y.c; } }; tEdge edge[100005]; int fa[1005]; int fathe

  • ccf 201412-2 Z字形扫描2019-10-29 23:54:03

    问题描述   给定一个n×n的矩阵,Z字形扫描的过程如下图所示:   对于下面的4×4的矩阵,   1 5 3 9  3 7 5 6  9 4 6 4  7 3 1 3  对其进行Z字形扫描后得到长度为16的序列:   1 5 3 9 7 3 9 5 4 7 3 6 6 4 1 3  请实现一个Z字形扫描的程序,给定一个n×n的矩阵,输出对这

  • 201412-1 门禁系统2019-09-23 22:08:18

    #include<bits/stdc++.h> using namespace std; int cnt[1100000];//cnt[i]表示i出现的次数 int ans[1100];//ans[i]表示第i个数据对应的输出 int main(void) { int n; cin>>n; memset(cnt,0,sizeof(cnt)); memset(ans,0,sizeof(ans));//初始化为全0

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

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

ICode9版权所有