- 博客(9)
- 收藏
- 关注
原创 CODEFORCES
AC代码:#include<stdio.h>#include<stdlib.h>int main(){ int m,n,i,j,l,sum=0,k; scanf("%d %d",&n,&m); int psoc[m],num[n],n_num[m]; char arr[n][m]; getchar(); ...
2019-08-10 08:40:33
206
1
原创 CODEFORCES
对于每一行和每一列先分别离散,记录每个位置在离散后的值,再合并之后取较大的那个,然后剩下的部分顺次编号C++源代码#include<iostream>#include<cstdio>#include<algorithm>using namespace std;#define MAX 1010inline int read(){ int...
2019-08-03 11:11:12
495
1
原创 矩阵之一
矩阵乘法的代码实现#include <stdio.h>#define ROW 2#define COL 3MultiplyMatrix(int a[ROW][COL], int b[COL][ROW],int c[ROW][ROW]){ int i, j, k; for (i = 0; i < ROW; i++) { for ...
2019-07-31 09:35:31
197
1
原创 CODEFORCES
题目: Watering Flowerstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA flowerbed has many flowers and two fountains.You can adjust the wa...
2019-07-31 09:19:17
154
原创 数据结构之二
之前我已经大致说明了堆栈的概念及特点,这次,我们用一种更加简单直观的方式将一个链表按逆序排列。#include<stdio.h>#include<stdlib.h>struct line{int num;struct line *next;} *p1, *p2;struct line *creat(){ int temp; struct l...
2019-07-24 09:06:28
214
1
原创 CODEFORCES Educational Codeforces Round 69 (Rated for Div. 2)
#include<stdio.h>#include<stdlib.h>int main(){ int i,j; long int n,T,*p,*pout; int max1,max2,maxpox; scanf("%ld",&T); pout=(long int*)malloc(T*sizeof(long int)...
2019-07-24 08:37:13
153
1
原创 数据结构之一
堆栈(Strack)是指这样一段内存,我们它可以理解为一个筒结构,先放进筒中的数据被后放进筒中的数据“压住”,只有后放进筒中的数据都取出后,先放进去的数据才能被取出,称为“后进先出”。堆栈的长度可随意增加。堆栈结构可用链表实现。设计一个链表结构需包含两个成员:一个存放数据,一个为指向下一个节点的指针。当每次有一个新数据要放入堆栈时,称为“压入堆栈”,这时动态建立一个链表的节点,并连接到链表的结尾;...
2019-07-19 19:05:24
364
1
原创 CODEFORCES
本题是codefoces上的题,题目编号为1191A - 16分析后知道是简单的多路选择的分支语句。源代码如下:#include<stdio.h>#include<stdlib.h>int main(){ int arr[4],n,x; char str[4]={'A','B','C','D'}; scanf("%d",&x);...
2019-07-16 08:29:30
163
1
原创 八皇后问题的C语言解法
八皇后问题在8×8格的国际象棋上摆放八个皇后,使其不能互相攻击,即任意两个皇后都不能处于同一行、同一列或同一斜线上,问有多少种摆法。八皇后问题,是一个古老而著名的问题,是回溯算法的典型案例。为了解决这个问题,我们把棋盘的横坐标定为i,纵坐标定为j,i和j的取值范围是从0到7。当某个皇后占了位置(i,j)时,在这个位置的垂直方向、水平方向和斜线方向都不能再放其它皇后了。第i个皇后选择位置的算法...
2019-07-15 22:05:59
826
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人