漏写的数字

#pragma comment(linker, "/STACK:102400000,102400000")
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<iostream>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<functional>
//#include<bits/stdc++.h>
using namespace std;
typedef long long lint; int cmp(const void * x, const void * y) {
#define datatype int
datatype dx = *((datatype *)(x)), dy = *((datatype *)(y));
//x < y
return dx > dy ? : -;
#undef datatype
} char str[];
int s[]; int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
#endif
std::ios::sync_with_stdio(), cin.tie();
cin >> str;
bool f, f1;
int n = strlen(str);
for (int i = ; i < n; i++) s[i] = str[i] - '';
int ans;
f = true, f1 = false;
int b = s[];
int ptr = ;
while (ptr < n) {
b++;
if (b < ) {
if (s[ptr] == b) {
ptr++;
continue;
} else {
if (f1) {
f = false;
break;
} else {
f1 = true;
ans = b;
}
}
} else {
if (s[ptr] == b / && s[ptr + ] == b % ) {
ptr += ;
continue;
} else {
if (f1) {
f = false;
break;
} else {
f1 = true;
ans = b;
}
}
}
}
if (f && f1) {
cout << ans << endl;
return ;
}
f = true, f1 = false;
b = s[] * + s[];
ptr = ;
while (ptr < n) {
b++;
if (b < ) {
if (s[ptr] == b) {
ptr++;
continue;
} else {
if (f1) {
f = false;
break;
} else {
f1 = true;
ans = b;
ptr++;
}
}
} else {
if (s[ptr] == b / && s[ptr + ] == b % ) {
ptr += ;
continue;
} else {
if (f1) {
f = false;
break;
} else {
f1 = true;
ans = b;
}
}
}
}
if (f && f1) {
cout << ans << endl;
return ;
}
return ;
}

扁平化管理

#pragma comment(linker, "/STACK:102400000,102400000")
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<iostream>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<functional>
//#include<bits/stdc++.h>
using namespace std;
typedef long long lint; int cmp(const void * x, const void * y) {
#define datatype int
datatype dx = *((datatype *)(x)), dy = *((datatype *)(y));
//x < y
return dx > dy ? : -;
#undef datatype
} lint a[][];
const lint inf = 0x7FFFFFFFFFFFFFFF; int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
#endif
std::ios::sync_with_stdio(), cin.tie();
for (int i = ; i < ; i++) {
for (int j = ; j < ; j++) {
lint aaa = , tmp = ;
if (i < j - ) continue;
for (int k = ; k < j; k++) {
aaa *= (i - k + );
tmp += aaa;
if (tmp > 1e18) break;
}
if (tmp > 1e18) a[i][j] = inf;
else a[i][j] = tmp;
}
}
lint n, l;
cin >> n >> l;
bool f = false;
for (int i = ; i < ; i++) {
for (int j = ; j < min((lint), l + ); j++) {
if (a[i][j] >= n && !f) {
cout << i << endl;
f = true;
}
}
}
if (!f) {
if (l == ) cout << n - << endl;
else if (l == ) {
lint tmp = (lint)sqrt(n);
if (tmp * tmp + >= n) cout << tmp << endl;
else cout << tmp + << endl;
} else {
for (int i = ;; i++) {
if (i < l - ) continue;
lint aaa = , tmp = ;
for (int k = ; k < l; k++) {
aaa *= (i - k + );
tmp += aaa;
if (tmp > 1e18) break;
}
if (tmp > n) {
cout << i << endl;
break;
}
}
}
}
return ;
}

小球染色

动态规划:dp[i][j]表示决定了前i个的颜色,最后j个颜色相同的方法数。

#pragma comment(linker, "/STACK:102400000,102400000")
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<iostream>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<functional>
//#include<bits/stdc++.h>
using namespace std;
typedef long long lint; int cmp(const void * x, const void * y) {
#define datatype int
datatype dx = *((datatype *)(x)), dy = *((datatype *)(y));
//x < y
return dx > dy ? : -;
#undef datatype
} lint dp[][];
const int mod = ; int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
#endif
std::ios::sync_with_stdio(), cin.tie();
int n, m, k;
cin >> n >> m >> k;
memset(dp, , sizeof(dp));
dp[][] = m;
for (int i = ; i <= n; i++) {
for (int j = ; j < k; j++) {
dp[i + ][j + ] = (dp[i + ][j + ] + dp[i][j]) % mod;
dp[i + ][] = (dp[i + ][] + dp[i][j] * (m - )) % mod;
}
}
lint ans = ;
for (int i = ; i < k; i++) ans = (ans + dp[n][i]) % mod;
cout << ans << endl;
return ;
}

三角形面积和2

最新文章

  1. MySQL 安装和启动服务,“本地计算机 上的 MySQL 服务启动后停止。某些服务在未由其他服务或程序使用时将自动停止。”
  2. 在Salesforce中通过 Debug Log 方式 跟踪逻辑流程
  3. 图层的transform属性
  4. [转]Jquery easyui开启行编辑模式增删改操作
  5. 开发一个App要多少钱?APP开发报价单,APP开发外包有哪些注意事项-广州达到信息www.ddapp.com.cn
  6. Mongodb 启动时 lock文件访问没有权限处理
  7. MFC连接Access讲解(3合1) .
  8. IE浏览器兼容问题(上)——html和css的兼容写法
  9. WPF控件自适应屏幕
  10. 【转载】SQL注入
  11. MVC设计模式思想及简单实现
  12. PowerDesigner15连接Oracle数据库并导出Oracle的表结构
  13. js获取选中日期的当周的周一和周日
  14. Docker 从入门到实践(一)Docker 简介
  15. hive建表报错:Specified key was too long; max key length is 767 bytes,hadoophive
  16. (转)浏览器对象window,history,location,navigator,screen
  17. MR室内室外用户区分
  18. L291
  19. [Hbase]Hbase知识大全
  20. oracle的启动和停用

热门文章

  1. vue组件的拆分
  2. [cf 1015f] Bracket Substring (dp+kmp)
  3. 使用Selenium爬取网站表格类数据
  4. IE下自定义错误页面不显示的原因
  5. 洛谷 P2805 BZOJ 1565 植物大战僵尸
  6. 1013MySQL监控利器-Innotop
  7. 0608MySQL备份与恢复之percona-xtrabackup软件的使用【基础】
  8. EXTJS之Ext.util.Observable自定义事件
  9. ASP.NET--常用ORM框架
  10. codevs 2460 树的统计