迷のbug
已解决(ps over%100写错了,应该是over/100。。。)
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
int gcd(int a, int b){return b == 0 ? a : gcd(a%b, a);}
const int N = 12;
int main()
{
int m, over = 0, re; double save = 0.;
for(int i = 0; scanf("%d", &m) and i < N; i++)
{
over += 300 - m;
if (over > 99) re = (over % 100) * 100, save += re, over -= re;
else if (over < 0) return printf("-%d\n", i + 1), 0;
}
save *= 1.2;
return printf("%d\n", over + (int)save), 0;
}
解决了(ps 因为我的m设置得还是太小了,改为0x3f3f3f3f就过了):
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define min(a, b) ((a) < (b) ? (a) : (b))
int gcd(int a, int b){return b == 0 ? a : gcd(a%b, a);}
const int N = 3;
int main()
{
int a, b, c, k, m = 100010;
scanf("%d", &a);
for(int i = 0; scanf("%d %d", &b, &c) && i < N; i++)
{
k = (int)ceil((double)a / (double)b);
m = min(m, k*c);
}
return printf("%d\n", m), 0;
}
P1308 只过了4个测试点,不知道什么原因。。。
#include <cstdio>
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i <= b; i++)
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))
#define index(a) (a - 'A')
#define transUpp(a) (a - 32)
#define transLow(a) (a + 32)
#define ll long long
int gcd(int a, int b){return b == 0 ? a : gcd(a%b, a);}
const int N = 1000010;
int main(int n, char**v)
{
string s; int letter[128];
char sen[N], word[10], *pw;
int count = -1, f, pos = N, i, x, l;
scanf("%s", word);
while(getchar() != '\n') continue;
getline(cin, s);
strcpy(sen, s.c_str());
for (int j = 0; j < 128; j++)
if (j < 26) letter[j] = 1;
else letter[j] = 0;
for (int j = 0; word[j]; j++)
if (letter[index(word[j])] != 0)
word[j] = transLow(word[j]);
for (int j = 0; sen[j]; j++)
if (letter[index(sen[j])] != 0)
sen[j] = transLow(sen[j]);
i = 0;
while(sen[i])
{
l = 0;
if (sen[i] == ' ')
{
i++;
continue;
}
f = 0, pw = word;
while(*pw)
if (*pw++ == sen[i++]) f = 1, x = i - 1, l++;
else
{
f = 0;
break;
}
if (f) pos = min(pos, x - l + 1), count++;
}
if (count > -1)
printf("%d %d\n", count + 1, pos);
else cout << count << endl;
return 0;
}
P1553 6个测试点没过。。不知道什么原因
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i <= b; i++)
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))
#define index(a) (a - 'A')
#define transUpp(a) (a - 32)
#define transLow(a) (a + 32)
#define ll long long
#define PB push_back
int gcd(int a, int b){return b == 0 ? a : gcd(a%b, a);}
const int N = 1000010;
int main(int n, char**v)
{
vector<char> s_;
char s[N];
cin >> s;
int i, j = -1, pos = -1;
for (i = 0; s[i]; i++)
if (s[i] == '%' || s[i] == '.' || s[i] == '/') pos = j = i;
if (j > -1)
{
while (s[--j] == '0');
while (s[j])
s_.PB(s[j--]);
s_.PB(s[pos++]);
while (s[pos] == '0') pos++;
}
while (s[i - 1] == '0') i--;
while (i-- > pos)
s_.PB(s[i]);
for (auto c : s_)
cout << c;
return 0;
}
迷のbug的更多相关文章
- Guava 是个风火轮之函数式编程(3)——表处理
云栖社区> 博客列表> 正文 Guava 是个风火轮之函数式编程(3)--表处理 潘家邦 2016-01-26 13:19:21 浏览1062 评论0 java Guava 摘要: 早先学 ...
- 【OpenCV】全景拼接
从OpenCV3.0正式版开始,features2d中的一些接口,搬到附加库xfeatures2d中了,其中就有SIFT.SURF的特征检测方法,但是正常下载安装OpenCV并不包含附加库,因为附加库 ...
- 踩坑之路_"var name = ' ';"_迷之BUG
情景介绍:最近写一个拖拽生成图表的工具,自己的思路每次mousedown的时候动态将this的name属性值赋值给全局中变量(自己手贱测试时直接将变量名命名为了'name',一大波bug还有30s到达 ...
- 迷之bug
是这样的.要解决tbody滚动,而thead不动的布局问题,我把它们分别放在两个表格里,上面的只有thead,下面的只有tbody, 然后解决宽度对齐的问题,我用colgroup设置每列的宽度,用的都 ...
- paip.提升效率--僵尸代码的迷思
paip.提升效率--僵尸代码的迷思 僵尸代码是指你的代码库里被注释掉的那部分代码, 很少去使用它,就像僵尸一样, 看雷kill-the-zombies-in-your-code ========== ...
- WP老杨解迷:如何营造让人花钱的游戏
游戏是最好做也是最不好做的项目,游戏的好坏现在都是直接从数据来说话,Windows Phone的游戏应用同样不可能逃出这个行业准则,要说在市场里做的好,那就直接拿数据来说,几乎没人会去在乎游戏到底传达 ...
- ionic 使用了 crosswalkwebview 所产生的bug 及 解决方案
一.问题产生: 在ionic app 优化方案中,我在前之前的博文中提到使用 --crosswalkwebview: 使用了crosswalkwebview后,app的显示及兼容效果确实很不错,虽然a ...
- bug终结者 团队作业第一周
bug终结者 团队作业第一周 小组组员及人员分工 小组成员 组长: 20162323 周楠 组员: 20162302 杨京典 20162322 朱娅霖 20162327 王旌含 20162328 蔡文 ...
- java 华容道 迷弟版(向 xd-女神 吴嘉欣致敬)
// Person.java 每个方块人物是一个类 package test; import javax.swing.*; import java.awt.*; import java.awt.eve ...
随机推荐
- Python :元组,不可修改的序列
- Electron – 项目报错整理(打包~1): WARNING: Make sure that .NET Framework 4.5 or later and Powershell 3 or later are installed, otherwise extracting the Electron zip file will hang.
WARNING: Make sure that .NET Framework 4.5 or later and Powershell 3 or later are installed, otherwi ...
- 如何转proto
找到对应协议在对应proto中的片段(片段的子也要提取),提出来 放到适合proto文件中(逻辑 || 功能近似协议聚集地) 转换成proto.js 替换 || 增加原有js内容
- AcWing 104. 货仓选址
#include <iostream> #include <algorithm> using namespace std; ; int n; int q[N]; int mai ...
- rke安装k8s cluster配置
rke安装k8s cluster配置 最简配置 cluster.yml nodes: - address: 192.168.0.103 user: lishikai role: [controlpla ...
- Spark 并行计算模型:RDD
Spark 允许用户为driver(或主节点)编写运行在计算集群上,并行处理数据的程序.在Spark中,它使用RDDs代表大型的数据集,RDDs是一组不可变的分布式的对象的集合,存储在executor ...
- mvn + testng + allure 生成自动化测试报告
最近学了个新东西,使用java的testng测试框架做自动化测试.并且声称自动化报告. (1)创建maven工程 File-New-Other (2)创建testng类 当前import org.te ...
- python-excel读取-pyodbc
https://github.com/mkleehammer/pyodbc/wiki/Cursor 利用pyodbc读取数据库,流程基本一样,就是配置connect对象时有所不同,下面是excel的: ...
- 在springboot项目中引入quartz任务调度器。
quartz是一个非常强大的任务调度器.我们可能使用它来管理我们的项目,常见的是做业绩统计等等.当然它的功能远不止这些.我们在这里不介绍quartz的原理,下面讲讲如何在springboot中使用qu ...
- 微信小程序UDP通信,注意点 接收 onMessage 收到的message是ArrayBuffer缓冲,不能直接输出,要另转String处理
1.WXML 页面代码 <!--index.wxml--> <view class="container"> <view class="us ...