题目描述

Bessie's cruel second grade teacher has assigned a list of N (1 <= N <= 100) positive integers I (1 <= I <= 10^60) for which Bessie must determine their parity (explained in second grade as 'Even... or odd?'). Bessie is overwhelmed by the size of the list and by the size of the numbers. After all, she only learned to count recently.

Write a program to read in the N integers and print 'even' on a single line for even numbers and likewise 'odd' for odd numbers.

POINTS: 25

Bessie那惨无人道的二年级老师搞了一个有 N 个正整数 I 的表叫Bessie去判断“奇偶性”(这个词语意思向二年级的学生解释,就是“这个数是单数,还是双数啊?”)。Bessie被那个表的长度深深地震惊到了,竟然跟栋栋的泛做表格一样多道题!!!毕竟她才刚刚学会数数啊。

写一个程序读入N个整数,如果是双数,那么在单立的一行内输出"even",如果是单数则类似地输出"odd".

输入输出格式

输入格式:

  • Line 1: A single integer: N

  • Lines 2..N+1: Line j+1 contains I_j, the j-th integer to determine even/odd

输出格式:

  • Lines 1..N: Line j contains the word 'even' or 'odd', depending on the parity of I_j

输入输出样例

输入样例#1: 复制

2
1024
5931
输出样例#1: 复制

even
odd

说明

Two integers: 1024 and 5931

1024 is eminently divisible by 2; 5931 is not

【代码】:

#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
char a[1005];//是大数 用字符串
cin>>n;
while(n--)
{
scanf("%s",a);
if((a[strlen(a)-1]-'0')%2==0)//判断奇偶只要看最后一位
puts("even");
else
puts("odd");
}
return 0;
}

  

洛谷 P2955 [USACO09OCT]奇数偶数Even? Odd?【字符串/易错】的更多相关文章

  1. P2955 [USACO09OCT]奇数偶数Even? Odd?

    题目描述 Bessie's cruel second grade teacher has assigned a list of N (1 <= N <= 100) positive int ...

  2. 题解 P2955 【[USACO09OCT]奇数偶数Even? Odd? 】

    很明显这题是个假入门! 小金羊一不小心点进题解发现了内幕 能看的出来都WA过Unsigned long long int 做题可以用Python,Python的变量虽然 强悍的不行! 但是我们可以用字 ...

  3. 洛谷P3832 [NOI2017]蚯蚓排队 【链表 + 字符串hash】

    题目链接 洛谷P3832 题解 字符串哈希然后丢到hash表里边查询即可 因为\(k \le 50\),1.2操作就暴力维护一下 经复杂度分析会发现直接这样暴力维护是对的 一开始自然溢出WA了,还以为 ...

  4. 洛谷 P2376 [USACO09OCT]津贴Allowance 解题报告

    P2376 [USACO09OCT]津贴Allowance 题目描述 作为创造产奶纪录的回报,\(Farmer\) \(John\)决定开始每个星期给\(Bessie\)一点零花钱. \(FJ\)有一 ...

  5. 洛谷——P2958 [USACO09OCT]木瓜的丛林Papaya Jungle

    P2958 [USACO09OCT]木瓜的丛林Papaya Jungle 题目描述 Bessie has wandered off the farm into the adjoining farmer ...

  6. 洛谷—— P1339 [USACO09OCT]热浪Heat Wave

    P1339 [USACO09OCT]热浪Heat Wave 题目描述 The good folks in Texas are having a heatwave this summer. Their ...

  7. 洛谷 P2959 [USACO09OCT]悠闲漫步The Leisurely Stroll

    P2959 [USACO09OCT]悠闲漫步The Leisurely Stroll 题目描述 Bessie looks out the barn door at the beautiful spri ...

  8. 洛谷 P2960 [USACO09OCT]Milkweed的入侵Invasion of the Milkweed

    P2960 [USACO09OCT]Milkweed的入侵Invasion of the Milkweed 题目描述 Farmer John has always done his best to k ...

  9. 洛谷 P2958 [USACO09OCT]木瓜的丛林Papaya Jungle

    P2958 [USACO09OCT]木瓜的丛林Papaya Jungle 题目描述 Bessie has wandered off the farm into the adjoining farmer ...

随机推荐

  1. 2018-10-19-C#-序列类为-xml-可以使用的特性大全

    title author date CreateTime categories C# 序列类为 xml 可以使用的特性大全 lindexi 2018-10-19 9:9:47 +0800 2018-6 ...

  2. T2988 删除数字【状压Dp+前缀和优化】

    Online Judge:从Topcoder搬过来,具体哪一题不清楚 Label:状压Dp+前缀和优化 题目描述 给定两个数A和N,形成一个长度为N+1的序列,(A,A+1,A+2,...,A+N-1 ...

  3. 4、uboot对设备树的支持

    第01节_传递dtb给内核 : r2 a. u-boot中内核启动命令: bootm <uImage_addr> // 无设备树,bootm 0x30007FC0 bootm <uI ...

  4. [CQOI2011]放棋子--DP

    题目描述: 输入格式 输入第一行为两个整数n, m, c,即行数.列数和棋子的颜色数.第二行包含c个正整数,即每个颜色的棋子数.所有颜色的棋子总数保证不超过nm.N,M<=30 C<=10 ...

  5. ubuntu触摸板失效问题

    很早便遇到这个问题,今天忍无可忍才度娘了一发.亲测有效! 用Ubuntu Tweak备份过桌面的配置,因此我尝试恢复桌面设置,果然奇迹发生了,触摸板立刻恢复了正常使用! 没有备份过的相信使用其中的重置 ...

  6. 关于ie11的浏览器检测

    我的电脑昨天更新的时候把ie11给更新出来了,然后发现我的skylineweb项目提示我的浏览器不是ie,这样显然是浏览器检测出现了问题.查找后找到了下面的解决方法.大家的电脑如果也更新成了ie11的 ...

  7. (视频分辨率介绍)混淆的概念:SIF与CIF、4CIF与D1

    http://www.microjie.com/index.php/professional-knowledge/82-standards-parterns/26-profession-knowled ...

  8. hibernate 注释多表 级联操作

    一对多模型(单向) 说明: 一个客户对应多个地址,通过客户可以获得该客户的多个地址的信息.客户和地址是一对多的关系,并且客户与地址是单向关联的关系. 映射策略 # 外键关联:两个表的关系定义在一个表中 ...

  9. 2019-5-21-asp-dotnet-core-图片在浏览器没访问可能原因

    title author date CreateTime categories asp dotnet core 图片在浏览器没访问可能原因 lindexi 2019-05-21 11:24:43 +0 ...

  10. 2019-2-19-win10-uwp-客户端如何发送类到-asp-dotnet-core-作为参数

    title author date CreateTime categories win10 uwp 客户端如何发送类到 asp dotnet core 作为参数 lindexi 2019-2-19 9 ...