题目大意:求一对()中的括号的对数/*(((()()())))000010101111 4 5 6666 r 当前')'前的'('的总数 1 1 1456 answer 3 4 5210 r2 与当前')'对应的'('的序号 (((()(())))(()()))000010011110010
原创 2023-08-21 16:44:04
67阅读
#include#includeusing namespace std;int t,n;char str[44];int go[44];int
原创 2023-07-27 18:45:37
49阅读
/*水题题意:学生的学号的每个位从后到前依次乘以9,3,7的和能被10整除,现在输入一些学号,但是某些位数丢失,让你补全。*/#include #include int main(void){ int i, j, k, t, len, sum, x, pos; int fac[] = {9,3,7}; char no[8]; scanf("%d", &
原创 2023-08-21 16:44:21
89阅读
题意:给定一个n*n的矩阵,求一个子矩阵,使得该矩阵的元素之和最大。
转载 2023-08-21 16:50:50
66阅读
/*把为配对的左括号计数,然后遇到右括号的时候左括号就配对一个,如果没有可以配对的,那么这个右括号是一定需要修改的,这样一直到最后未配对的左括号数只需要修改一半即可完成配对*/#include#includeint main(){ int i,cnt=0,ans,temp,l; char str[10000]; while(gets(str)) {
原创 2023-08-21 16:45:29
80阅读
北大ACM题分类主流算法:  1、搜索 //回溯  2、DP( 动态规划 )//记忆化搜索  3、贪心   4、图论 //最短路径、最小生成树、网络流  5、数论 //组合数学(排列组合)、递推关系、质因数法  6、计算几何 //凸壳、同等安置矩形的并的面积与周长、凸包计算问题  8、模拟   9、数据结构 //并查集、堆、树形结构  10、博弈论   
转载 2023-05-23 16:04:05
45阅读
网上搜来的借鉴一下 #include     {         int p[300]={1},tmp=0;         f*=1e6;         for(
原创 2023-08-21 16:50:43
74阅读
//3751#includemain(){ int test,hour,h; char ye[5],mo[6],mi[6],ap; scanf("%d",&test); while(test--) { scanf("%4s/%5s-%d:%s",ye,mo,&hour,mi);//输入日期时间 h=hour%12; ap=hour/12?'p':
原创 2023-08-21 16:46:24
51阅读
//1218//题目大意:喝第一杯酒,每隔0个门,操控门一次,喝第二杯酒,每隔1个门,操控门一次...//统计开着的门的个数 #includemain(){ int n,i,j,k,a,count,counter; scanf("%d",&n); for(i=1;i<=n;i++) { counter=0; scanf("%d",&a); f
原创 2023-08-21 16:47:43
84阅读
//2840#includemain(){ int t,a,b; scanf("%d",&t); while(t--) { scanf("%d:%d",&a,&b); b?puts("0"):printf("%d\n",a>12?a-12:a+12); }}
原创 2023-08-21 16:47:55
49阅读
/*思路:先找出第一个1,统计从第一个1开始连续1的个数,并把1变成0,如果1的下一位是0,把0变成1,然后从最低位开始找不是1的位赋值为1,直到1的个数符合原数字1的个数*/ #includeint main(){ int n,k,s; int i,j,sum; int flag1,flag2; int a[100],b[100]; while(sca
原创 2023-08-21 16:47:59
44阅读
由于深度一定(m),所以使用深度优先搜索,自上而下的设定蛋糕序号,最顶层的为第1层,……,最底层的蛋糕为第m层,很明显满足
原创 2023-08-21 16:48:22
78阅读
(字典树的问题) 题目大意:化简字符串。 #include#include#include#define max 26typedef struct node//字典树节点信息{ struct node * next[max]; int flag;//记录字母出现的次数}node,* Node;Node root;//根节点//str[][]记录输
原创 2023-08-21 16:48:25
67阅读
找规律#include int main(){ int n, x, y; scanf("%d", &n); while(n--) { scanf("%d%d", &x, &y); if (x == y || x == y + 2)//如果x等于y或x比y大2 { i
原创 2023-08-21 16:48:35
65阅读
//1564#includeint ans[12], n, k, list[12], f;void search(int i, int s)//从list[i]开始找和为s的序列 {    int j;    if (!s)//如果s的长度变为0,说明已经, printf("%d", ans[0])
原创 2023-09-22 09:11:49
78阅读
DNA SortingTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 75079Accepted: 30074Description One measure of ``unsortedness'' in a sequence is the number of pairs of entries that are out of order with respect to each other. For instance, in the letter sequence ``DAABEC'', this
转载 2013-08-23 18:22:00
59阅读
//3673#include#includemain(){ char a[11],b[11]; int i,j,la,lb; double sum=0; scanf("%s%s",a,b); la=strlen(a); lb=strlen(b); for(i=0;i<la;i++) for(j=0;j<lb;j++) sum+=(a[i]-
原创 2023-08-21 16:45:36
54阅读
//1298#include#includemain(){ char s[27]={"VWXYZABCDEFGHIJKLMNOPQRSTU"},word[100]; int i; while(1) { i=0;
原创 2023-08-21 16:45:53
3阅读
//解方程 x=a+b,y=|a-b|,求a b#include #include main(){ int n; scanf("%d",&n); while(n--) { int x,y,c; scanf("%d%d",&x,&y); c=x-y; if(x<y||c%2
原创 2023-08-21 16:46:03
63阅读
//当然,直接取模也能过#includemain(){ int a,b; int i; while(~scanf("%d%d",&a,&b)) { i=a/b; a=a-b*i; printf("%d\n",a); }}
原创 2023-08-21 16:46:13
51阅读
  • 1
  • 2
  • 3
  • 4
  • 5