http://acm.hdu.edu.cn/game/entry/problem/list.php?chapterid=1§ionid=2

1.2.5
#include<stdio.h>
/*
题意:找闰年。 if((i%4==0 && i%100!=0) || i%400==0)count++;
3
2005 25
1855 12
2004 10000
2108
1904
43236
*/
int main()
{
int t,y,n;
int i,count=0;
while(scanf("%d",&t)==1)
{
while(t--)
{
count = 0;
scanf("%d%d",&y,&n);
for (i=y;count<n;i++)
{
if((i%4==0 && i%100!=0) || i%400==0)
count++;
}
printf("%d\n",i-1);
}
}
return 0;
}
1.2.6
#include "stdafx.h"
/*
题意:计算每行1的个数
2
2 2
1 1
0 0
3 3
1 0 1
0 0 1
1 1 0 2
5
*/
#include <cstdio>
#include <cstdlib>
#include <stdio.h>
int main(){
int n, m, z;
scanf("%d", &z);
int c=0;
//int r=0,g=0;
int *r;
while (z-- != 0)
{
scanf("%d%d", &n,&m);
while(n-- != 0)
{
r = (int*)malloc(sizeof(int)*m);
for (int i = 0; i < m;++i)
{
scanf("%d",r+i);
if (r[i] == 1)
c++;
}
}
printf("%d\n", c);
c = 0;
}
return 0;
}
1.2.7
#include<stdio.h>
/*
题意:转10进制做加法
3
1(2)
2(3)
3(4) 4
11(10)
11(2)
11(3)
11(4) 6
23
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h> int sum; int pow(int x, int i)
{
if(i == 0)
return 1;
else if(i == 1)
return x;
else
return x * pow(x, i - 1);
} void fun(int x, int n)
{
int i = 0, p;
while(x) {
p = x % 10;
sum += p * pow(n, i);
x = x / 10;
i++;
}
}
int main( )
{
int N, a,b, i;
while(scanf("%d", &N)!=EOF)
{
sum = 0;
for(i = 1; i <= N; i++)
{
scanf("%d(%d)",&a, &b);
if (b == 10)
{
sum += a;
continue;
}
fun(a, b);
}
printf("%d\n",sum);
}
return 0;
}
1.2.8
/*
题意:元音词,数组映射,aAeEiIoOuU
4
XYz
application
qwcvb
aeioOa xyz
ApplIcAtIOn
qwcvb
AEIOOA
*/
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
using namespace std;
int alpha[256];
int main(){
int n;
char text[55];
alpha['a']=alpha['A']=alpha['e']=alpha['E']=alpha['i']=alpha['I']=alpha['o']=alpha['O']=alpha['u']=alpha['U']=1;
while(scanf("%d",&n)!=EOF){
while(n--){
scanf("%s",text);
int len=strlen(text);
for(int i=0;i<len;++i){
if(alpha[text[i]]){
putchar(toupper(text[i]));
}else{
putchar(tolower(text[i]));
}
}
puts("");
}
}
return 0;
}


杭电OJ(HDU)-ACMSteps-Chapter Two-《An Easy Task》《Buildings》《decimal system》《Vowel Counting》的更多相关文章

  1. 杭电OJ(HDU)-ACMSteps-Chapter Three-《FatMouse&#39; Trade》《今年暑假不AC》《排名》《开门人和关门人》

    watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY2Fpc2luaV92Yw==/font/5a6L5L2T/fontsize/400/fill/I0JBQk ...

  2. 『ACM C++』HDU杭电OJ | 1415 - Jugs (灌水定理引申)

    今天总算开学了,当了班长就是麻烦,明明自己没买书却要带着一波人去领书,那能怎么办呢,只能说我善人心肠哈哈哈,不过我脑子里突然浮起一个念头,大二还要不要继续当这个班委呢,既然已经体验过就可以适当放下了吧 ...

  3. C#利用POST实现杭电oj的AC自动机器人,AC率高达50%~~

    暑假集训虽然很快乐,偶尔也会比较枯燥,,这个时候就需要自娱自乐... 然后看hdu的排行榜发现,除了一些是虚拟测评机的账号以外,有几个都是AC自动机器人 然后发现有一位作者是用网页填表然后按钮模拟,, ...

  4. 用python爬取杭电oj的数据

    暑假集训主要是在杭电oj上面刷题,白天与算法作斗争,晚上望干点自己喜欢的事情! 首先,确定要爬取哪些数据: 如上图所示,题目ID,名称,accepted,submissions,都很有用. 查看源代码 ...

  5. 爬取杭电oj所有题目

    杭电oj并没有反爬 所以直接爬就好了 直接贴源码(参数可改,循环次数可改,存储路径可改) import requests from bs4 import BeautifulSoup import ti ...

  6. 杭电oj 2095 & 异或^符号在C/C++中的使用

    异或^符号,在平时的学习时可能遇到的不多,不过有时使用得当可以发挥意想不到的结果. 值得注意的是,异或运算是建立在二进制基础上的,所有运算过程都是按位异或(即相同为0,不同为1,也称模二加),得到最终 ...

  7. 杭电oj 4004---The Frog Games java解法

    import java.util.Arrays; import java.util.Scanner; //杭电oj 4004 //解题思路:利用二分法查找,即先选取跳跃距离的区间,从最大到最小, // ...

  8. 杭电oj————2057(java)

    question:A+ B again 思路:额,没啥思路/捂脸,用java的long包里的方法,很简单,只是有几次WA,有几点要注意一下 注意:如果数字有加号要删除掉,这里用到了正则表达式“\\+” ...

  9. 『ACM C++』HDU杭电OJ | 1418 - 抱歉 (拓扑学:多面体欧拉定理引申)

    呕,大一下学期的第一周结束啦,一周过的挺快也挺多出乎意料的事情的~ 随之而来各种各样的任务也来了,嘛毕竟是大学嘛,有点上进心的人多多少少都会接到不少任务的,忙也正常啦~端正心态 开心面对就好啦~ 今天 ...

随机推荐

  1. spring mvc 下载的时候中文文件名不显示

    Headers.add("Content-Disposition", "attachment;filename=" + new String(file.getB ...

  2. Apache Tez on hive

    ———————————————————— 调配 Hadoop  ———————————————————— 1 将 编译好的 TEZ .tar.gz 文件上传到 HDFS 中.   hdfs fs -p ...

  3. 使用BabeLua在cocos2d-x中编辑和调试Lua

    使用BabeLua在cocos2d-x中编辑和调试Lua BabeLua是一款基于VS2012/2013的Lua集成开发环境,具有Lua语法高亮,语法检查.自己主动补全.高速搜索,注入宿主程序内对Lu ...

  4. HDU 2865

    和上题一样,但K较大,不能直接用矩阵来写.这个矩阵必定是这个形式的. 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 分成对角线上元素B与非对角线上元素A k: 1 2 3 4 ... ...

  5. 《JAVA程序设计》实训第二天——《猜猜看》游戏

    课程实训第二天,我在第一天的基础上去导入目录,第一天那时候一直改动都是改动不到,上网找了相关的知识.问了同学该怎么去导入显示图片. public class weiwei extends JFrame ...

  6. JSP简单练习-上传文件

    注意:在编写上传文件的代码时,需确保"WEB-INF/lib"下含有jspsmartupload.jar包.否则会出错. jspSmartupload.jar下载 <!-- ...

  7. yii自己定义CLinkPager分页

    在components中自己定义LinkPager.并继承CLinkPager 代码例如以下: <? php /** * CLinkPager class file. * * @author l ...

  8. Ubuntu 16.04 安装 Open Jdk

    sudo add-apt-repository ppa:openjdk-r/ppa sudo apt-get update sudo apt-get install openjdk-7-jdk

  9. hdoj--1384--Intervals(差分约束)

    Intervals Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total ...

  10. poj--3250--Bad Hair Day(模拟)

    Bad Hair Day Time Limit: 2000MS   Memory Limit: 65536KB   64bit IO Format: %I64d & %I64u Submit ...