Codeforces Round #108 (Div. 2)

这次的CF还有上次hdu的比赛让我发现自己在遇到那种简单体时,心理总是静不下来,老是还没整理好思路就开始敲代码,结果弄得Bug无数,还有就是那种中等难度的题目,思路还是不够成熟,有时能够做出,有时要想半天,对于难题没有接触过的当然还是不会了。自己做题还是太少,接触到的知识还是太少,对于每个算法的理解还是不够熟练。所以最近几个周要坚持按照计划来,扎实的造好每一步。加油。。。

悲剧,从第一次做cf开始rating一直是降得。。。唉。。。好吧,只能加油了》

http://codeforces.com/contest/152/problem/A

简单题,分别给出了n个人的m科课程的分数没找出拥有这科最高分的同学数量。

View Code
#include <iostream>
#include <cstring>
#include <cstdio>
#include <iostream>
#define maxn 107
using namespace std;
int a[maxn];
int n,m;
struct node
{
char a[maxn];
}tagp[maxn];
int hash[maxn];
int main()
{
int i,j;
while (~scanf("%d%d",&n,&m))
{
for (i = 0; i < maxn; ++i)
{
hash[i] = 0;
a[i] = -1;
}
for (i = 0; i < n; ++i)
{
scanf("%s",tagp[i].a);
for (j = 0; j < m; ++j)
{
a[j] = max(a[j],tagp[i].a[j] - '0');
}
}
for (i = 0; i < m; ++i)
{
for (j = 0; j < n ; ++j)
{
if (tagp[j].a[i] - '0' == a[i])
hash[j] = 1;
}
}
int ct = 0;
for (i = 0; i < n; ++i)
{
if (hash[i]) ct++;
}
printf("%d\n",ct);
}
return 0;
}

http://codeforces.com/contest/152/problem/B

给你一个矩阵,以及远点,然后给出k组出向量,在不出矩阵的前提下,问最多能走多少不,才开始我是一步一步模拟的结果超时,开始自己根本就没有算好时间效率。

最后就是计算X轴上最多能走多少不,Y轴上最多能走多少不,然后去最小值就好了,还要注意数据—int64由于我的不仔细,出了好几次错。唉。。

View Code
#include <iostream>
#include <cstring>
#include <cstdio>
#include <iostream>
#define maxn 107
using namespace std;
int n,m,k;
int main()
{
int i,k;
int x,y,dx,dy;
while (cin>>n>>m)
{
cin>>x>>y;
cin>>k;
__int64 sum,a,b,c;
sum = 0;
for (i = 0; i < k; ++i)
{
a = b = 0;
cin>>dx>>dy;
if (dx > 0)
a = (n - x)/dx;
else if(dx < 0)
a = (x - 1)/(-dx);
else
a = 9999999999;
if (dy > 0)
b = (m - y)/dy;
else if(dy < 0)
b = (y - 1)/(-dy);
else
b = 9999999999;
c = min(a,b);
//printf(">>%d %d %d\n",a,b,c);
if (c > 0 && c != 9999999999)
{
sum += c;
x += (c*dx);
y += (c*dy);
}
}
printf("%I64d\n",sum);
}
return 0;
}


只是做出了这几个简单题,,,大牛尽情来鄙视。。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值