Codeforces April Fools Day Contest 2013

2013年愚人节的坑题。。。

A. Mysterious strings
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
Input

The input contains a single integer a (1 ≤ a ≤ 40).

Output

Output a single string.

Sample test(s)
input
2
output
Adams
input
8
output
Van Buren
input
29
output
Harding

呵呵,看完代码还是不知道这题是什么意思吧。好吧,提示关键字:美国总统。。。

AC代码如下:

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;

char a[][15]={"","Washington","Adams","Jefferson","Madison","Monroe",
                "Adams","Jackson","Van Buren","Harrison","Tyler",
                "Polk","Taylor","Fillmore","Pierce","Buchanan",
                "Lincoln","Johnson","Grant","Hayes","Garfield",
                "Arthur","Cleveland","Harrison","Cleveland","McKinley",
                "Roosevelt","Taft","Wilson","Harding","Coolidge",
                "Hoover","Roosevelt","Truman","Eisenhower","Kennedy",
                "Johnson","Nixon","Ford","Carter","Reagan",
                "Bush","Clinton","Bush","Obama"};
int main(){
    int n;
    scanf("%d", &n);
    printf("%s", a[n]);
    return 0;
}


B. QR code
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
Input

The input contains two integers a1, a2 (0 ≤ ai ≤ 32), separated by a single space.

Output

Output a single integer.

Sample test(s)
input
1 1
output
0
input
3 7
output
0
input
13 10
output
1


又是一道不明所以的题,提示关键字:扫二维码。。。

二维码地址:http://tc-alchemy.progopedia.com/qr-code.txt


AC代码:

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;

char a[][35] = {"111111101010101111100101001111111",
                "100000100000000001010110001000001",
                "101110100110110000011010001011101",
                "101110101011001001111101001011101",
                "101110101100011000111100101011101",
                "100000101010101011010000101000001",
                "111111101010101010101010101111111",
                "000000001111101111100111100000000",
                "100010111100100001011110111111001",
                "110111001111111100100001000101100",
                "011100111010000101000111010001010",
                "011110000110001111110101100000011",
                "111111111111111000111001001011000",
                "111000010111010011010011010100100",
                "101010100010110010110101010000010",
                "101100000101010001111101000000000",
                "000010100011001101000111101011010",
                "101001001111101111000101010001110",
                "101101111111000100100001110001000",
                "000010011000100110000011010000010",
                "001101101001101110010010011011000",
                "011101011010001000111101010100110",
                "111010100110011101001101000001110",
                "110001010010101111000101111111000",
                "001000111011100001010110111110000",
                "000000001110010110100010100010110",
                "111111101000101111000110101011010",
                "100000100111010101111100100011011",
                "101110101001010000101000111111000",
                "101110100011010010010111111011010",
                "101110100100011011110110101110000",
                "100000100110011001111100111100000",
                "111111101101000101001101110010001"};
int main() {
    int x, y;
    scanf("%d %d", &x, &y);
    printf("%c\n", a[x][y]);
    return 0;
}


C. WTF?
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
HAI
I HAS A TUX
GIMMEH TUX
I HAS A FOO ITS 0
I HAS A BAR ITS 0
I HAS A BAZ ITS 0
I HAS A QUZ ITS 1
TUX IS NOW A NUMBR
IM IN YR LOOP NERFIN YR TUX TIL BOTH SAEM TUX AN 0
I HAS A PUR
GIMMEH PUR
PUR IS NOW A NUMBR
FOO R SUM OF FOO AN PUR
BAR R SUM OF BAR AN 1
BOTH SAEM BIGGR OF PRODUKT OF FOO AN QUZ AN PRODUKT OF BAR BAZ AN PRODUKT OF FOO AN QUZ
O RLY?
YA RLY
BAZ R FOO
QUZ R BAR
OIC
IM OUTTA YR LOOP
BAZ IS NOW A NUMBAR
VISIBLE SMOOSH QUOSHUNT OF BAZ QUZ
KTHXBYE
Input

The input contains between 1 and 10 lines, i-th line contains an integer number xi (0 ≤ xi ≤ 9).

Output

Output a single real number. The answer is considered to be correct if its absolute or relative error does not exceed 10 - 4.

Sample test(s)
input
3
0
1
1
output
0.666667


C题的描述更是混沌一片,Google了半天,才发现了其中奥秘。提示关键字:LOLCODE。

做这道题之前首先要掌握LOLCODE语言的语法规则,然后就可以A了。


AC代码如下:

#include <cstdio>
#include <cstring>
#include<iostream>
using namespace std;

int main(){
	int n;
	cin >> n;
    int foo = 0, bar = 0, baz = 0, quz = 1;
    for (int i = 0; i < n; i++) {
        int pur;
        cin >> pur;
        foo += pur;
        bar++;
        if (foo * quz > baz * bar) {
            baz = foo;
            quz = bar;
        }
    }
    cout << 1.0*baz/quz <<endl;
}


D. Orange
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
Input

The first line of the input is a string (between 1 and 50 characters long, inclusive). Each character will be a letter of English alphabet, lowercase or uppercase.

The second line of the input is an integer between 0 and 26, inclusive.

Output

Output the required string.

Sample test(s)
input
AprilFool
14
output
AprILFooL

根据图画过程编写程序。提示:蛇,心,手指什么的都是一个变量。


AC代码如下:

#include <cstdio>
#include <cstring>

int main() {
    int n;
    char s[51];
    scanf("%s %d", s, &n);
    int len = strlen(s);
    for (int i = 0; i < len; i++) {
        if (s[i] < 'a')
            s[i] += 'a' - 'A';
        if (s[i] < 97 + n)
            s[i] += 'A' - 'a';
    }
    printf("%s\n", s);
    return 0;
}


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值