Codeforces April Fools Day Contest 2013

2024-06-24 03:32

本文主要是介绍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;
}


这篇关于Codeforces April Fools Day Contest 2013的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1089047

相关文章

day-51 合并零之间的节点

思路 直接遍历链表即可,遇到val=0跳过,val非零则加在一起,最后返回即可 解题过程 返回链表可以有头结点,方便插入,返回head.next Code /*** Definition for singly-linked list.* public class ListNode {* int val;* ListNode next;* ListNode() {}*

Codeforces Round #240 (Div. 2) E分治算法探究1

Codeforces Round #240 (Div. 2) E  http://codeforces.com/contest/415/problem/E 2^n个数,每次操作将其分成2^q份,对于每一份内部的数进行翻转(逆序),每次操作完后输出操作后新序列的逆序对数。 图一:  划分子问题。 图二: 分而治之,=>  合并 。 图三: 回溯:

Codeforces Round #261 (Div. 2)小记

A  XX注意最后输出满足条件,我也不知道为什么写的这么长。 #define X first#define Y secondvector<pair<int , int> > a ;int can(pair<int , int> c){return -1000 <= c.X && c.X <= 1000&& -1000 <= c.Y && c.Y <= 1000 ;}int m

Codeforces Beta Round #47 C凸包 (最终写法)

题意慢慢看。 typedef long long LL ;int cmp(double x){if(fabs(x) < 1e-8) return 0 ;return x > 0 ? 1 : -1 ;}struct point{double x , y ;point(){}point(double _x , double _y):x(_x) , y(_y){}point op

Codeforces Round #113 (Div. 2) B 判断多边形是否在凸包内

题目点击打开链接 凸多边形A, 多边形B, 判断B是否严格在A内。  注意AB有重点 。  将A,B上的点合在一起求凸包,如果凸包上的点是B的某个点,则B肯定不在A内。 或者说B上的某点在凸包的边上则也说明B不严格在A里面。 这个处理有个巧妙的方法,只需在求凸包的时候, <=  改成< 也就是说凸包一条边上的所有点都重复点都记录在凸包里面了。 另外不能去重点。 int

2014 Multi-University Training Contest 8小记

1002 计算几何 最大的速度才可能拥有无限的面积。 最大的速度的点 求凸包, 凸包上的点( 注意不是端点 ) 才拥有无限的面积 注意 :  凸包上如果有重点则不满足。 另外最大的速度为0也不行的。 int cmp(double x){if(fabs(x) < 1e-8) return 0 ;if(x > 0) return 1 ;return -1 ;}struct poin

2014 Multi-University Training Contest 7小记

1003   数学 , 先暴力再解方程。 在b进制下是个2 , 3 位数的 大概是10000进制以上 。这部分解方程 2-10000 直接暴力 typedef long long LL ;LL n ;int ok(int b){LL m = n ;int c ;while(m){c = m % b ;if(c == 3 || c == 4 || c == 5 ||

2014 Multi-University Training Contest 6小记

1003  贪心 对于111...10....000 这样的序列,  a 为1的个数,b为0的个数,易得当 x= a / (a + b) 时 f最小。 讲串分成若干段  1..10..0   ,  1..10..0 ,  要满足x非递减 。  对于 xi > xi+1  这样的合并 即可。 const int maxn = 100008 ;struct Node{int

Codeforces 482B 线段树

求是否存在这样的n个数; m次操作,每次操作就是三个数 l ,r,val          a[l] & a[l+1] &......&a[r] = val 就是区间l---r上的与的值为val 。 也就是意味着区间[L , R] 每个数要执行 | val 操作  最后判断  a[l] & a[l+1] &......&a[r] 是否= val import ja

rtmp流媒体编程相关整理2013(crtmpserver,rtmpdump,x264,faac)

转自:http://blog.163.com/zhujiatc@126/blog/static/1834638201392335213119/ 相关资料在线版(不定时更新,其实也不会很多,也许一两个月也不会改) http://www.zhujiatc.esy.es/crtmpserver/index.htm 去年在这进行rtmp相关整理,其实内容早有了,只是整理一下看着方