E

模拟

#include <bits/stdc++.h>
#define PI acos(-1.0)
#define mem(a,b) memset((a),b,sizeof(a))
#define TS printf("!!!\n")
#define pb push_back
#define inf 1e9
//std::ios::sync_with_stdio(false);
using namespace std;
//priority_queue<int,vector<int>,greater<int>> que; get min
const double eps = 1.0e-10;
const double EPS = 1.0e-4;
typedef pair<int, int> pairint;
typedef long long ll;
typedef unsigned long long ull;
//const int maxn = 3e5 + 10;
const int turn[][] = {{, }, { -, }, {, }, {, -}};
//priority_queue<int, vector<int>, less<int>> que;
//next_permutation
int cat[];
priority_queue<pair<int, int>, vector<pair<int, int> >, greater<pair<int, int> > > que;
int main()
{
int m, n, x;
while (cin >> m >> n >> x)
{
int anser1 = m;
int anser2 = ;
for (int i = ; i <= n; i++)
{
scanf("%d", &cat[i]);
que.push(make_pair(, cat[i]));
}
while (!que.empty())
{
pair<int, int> cnt = que.top();
if (cnt.first >= x)
{
que.pop();
continue;
}
else
{
que.pop();
if (anser1 > )
{
cnt.first += cnt.second;
if (cnt.first <= x)
{
anser1--;
}
else
{
anser1--;
anser2++;
}
que.push(cnt);
}
}
}
cout << anser1 << " " << anser2 << endl;
}
}

F

#include <bits/stdc++.h>
#define PI acos(-1.0)
#define mem(a,b) memset((a),b,sizeof(a))
#define TS printf("!!!\n")
#define pb push_back
#define inf 1e9
//std::ios::sync_with_stdio(false);
using namespace std;
//priority_queue<int,vector<int>,greater<int>> que; get min
const double eps = 1.0e-10;
const double EPS = 1.0e-4;
typedef pair<int, int> pairint;
typedef long long ll;
typedef unsigned long long ull;
//const int maxn = 3e5 + 10;
const int turn[][] = {{, }, { , }, { , -}, { -, }};
//priority_queue<int, vector<int>, less<int>> que;
//next_permutation
char f[][];
char ans[];
char anser[][];
int pop = ;
int dx, dy;
int dir;
int n;
bool check(int x, int y)
{
if (x > n || x < )
{
return false;
}
if (y > n || y < )
{
return false;
}
if (anser[x][y] != '.')
{
return false;
}
return true;
}
int main()
{
while (cin >> n)
{
for (int i = ; i <= ; i++)
{
for (int j = ; j <= ; j++)
{
anser[i][j] = '.';
}
}
dir = ;
dx = dy = ;
pop = ;
for (int i = ; i <= n; i++)
{
scanf("%s", f[i] + );
}
for (int i = ; i <= n + ; i++)
{
if (i % == )
{
for (int j = i - ; j >= ; j--)
{
ans[++pop] = f[j][i - j];
}
}
else
{
for (int j = ; j <= i - ; j++)
{
ans[++pop] = f[j][i - j];
} }
}
for (int i = n + ; i <= * n; i++)
{
if (i % == )
{
for (int j = n; j >= i - n; j--)
{
ans[++pop] = f[j][i - j];
} }
else
{
for (int j = i - n; j <= n; j++)
{
ans[++pop] = f[j][i - j];
}
}
}
// for (int i = 1; i <= pop; i++)
// {
// cout << ans[i];
// }
// cout << endl;
for (int i = ; i <= pop; i++)
{
//cout<<dx<<" "<<dy<<endl;
anser[dx][dy] = ans[i];
if (!check(dx + turn[dir][], dy + turn[dir][]))
{
dir = (dir + ) % ;
}
dx = dx + turn[dir][];
dy = dy + turn[dir][];
}
for (int i = ; i <= n; i++)
{
for (int j = ; j <= n; j++)
{
cout << anser[i][j];
}
cout << endl;
}
}
}

J

石子合并 不过合并的范围由2变为L-R(2<=L<=R<=N) 问你最少的花费是多少

最新文章

  1. kvm上的Linux虚拟机使用virtio磁盘
  2. 4、Python:strip(),split()
  3. An Introduction to Interactive Programming in Python (Part 1) -- Week 2_1 练习
  4. 借助adb与gdb确认app内存缓存中是否存在用户敏感数据
  5. [PWA] 18. Clean the photo cache
  6. 自定义类似QMutexLocker的CMutexLocker
  7. 开篇ASP.NET MVC 权限管理系列
  8. redis整合spring
  9. Struts2--Result类型
  10. window.location获取URL中各部分
  11. 【转】23种设计模式UML图
  12. CentOS7下安装MariaDB
  13. newInstance 与new的区别
  14. [SDOI2015]约数个数和
  15. Linux中的端口占用问题
  16. rails4 new没有生成prototype.js之类的脚本解决办法
  17. Python_Mix*内置函数
  18. functools 之 partial(偏函数)
  19. content字符生成配合CSS3 animation的点点点loading
  20. mysql用户操作、权限分配、远程登录设置

热门文章

  1. CentOS7_装机软件推荐
  2. window.screenLeft&amp;&amp;window.screenTop&amp;&amp;window.screenX&amp;&amp;window.screenY
  3. ETF替代规则
  4. IDE引入mindmap插件,在项目中添加思维导图
  5. Lesson 5 The facts
  6. Windows.命令行(CMD)_执行命令&amp;环境变量
  7. Python-自定义函数-参数
  8. 指定pom文件jdk版本
  9. [官网]Prevent a worm by updating Remote Desktop Services (CVE-2019-0708)
  10. 使用extract-text-webpack-plugin插件后报错