摘要:
最长递增子序列#include <iostream>#include <cstdlib>#include <cstdio>#include <cstring>using namespace std;#define maxn 40004int n;int f[maxn];int d[maxn];int m;void input(){ scanf("%d", &n); for (int i = 0; i < n ;i++) scanf("%d", &f[i]);}int binarysea 阅读全文
摘要:
最短路map如果要使用char*作为key,不能简单的直接使用,可以用string作为map的key,使用的时候将char*转换为string。转换的方法是使用string的assign函数。string.assign(char*);#include <iostream>#include <cstdlib>#include <cstdio>#include <cstring>#include <algorithm>#include <map>using namespace std;#define maxn 205#defi 阅读全文
摘要:
简单题#include <iostream>#include <cstdlib>#include <cstdio>#include <cstring>using namespace std;#define maxn 105int n;int sum_row[maxn];int sum_col[maxn];int f[maxn][maxn];void input(){ for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) scanf("%d", &f[ 阅读全文
摘要:
简单题#include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;int a, b, c, d;int cal(int a){ return (a + 40) % 40;}int main(){ while (scanf("%d%d%d%d", &a, &b, &c, &d), a | b | c | d) { int ans = cal(a - b) + cal(c - 阅读全文
摘要:
简单题#include <iostream>#include <cstdlib>#include <cstdio>#include <cstring>using namespace std;#define maxn 1005int n;int f[maxn];double average;void input(){ int sum = 0; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d", &f[i]); sum += 阅读全文