| 分类:topCoder |
| 分类:topCoder |
Problem Statement |
||||||||
| |
Julius Caesar used a system of cryptography, now known as Caesar Cipher, which shifted each letter 2 places further through the alphabet (e.g. 'A' shifts to 'C', 'R' shifts to 'T', etc.). At the end of the alphabet we wrap around, that is 'Y' shifts to 'A'. We can, of course, try shifting by any number. Given an encoded text and a number of places to shift, decode it. For example, 'TOPCODER' shifted by 2 places will be encoded as 'VQREQFGT'. In other words, if given (quotes for clarity) 'VQREQFGT' and 2 as input, you will return 'TOPCODER'. See example 0 below. |
|||||||
Definition |
||||||||
| |
|
|||||||
| 分类:topCoder |
| 分类:topCoder |
Problem Statement |
|
| |
Tommy is learning a simple card game called Circle. To play the game, the single player shuffles a deck of cards. He or she then flips through the deck, removing all instances of the 'K' card, and all consecutive pairs of cards that add up to 13. The deck does wrap around, so that if the last card remaining in the deck and the first card remaining in the deck add up to 13, they are both removed. The player keeps cycling through the deck until no more cards can be removed. Create a class CircleGame containing the method cardsLeft that takes a string deck representing a not-necessarily complete nor correct deck of cards. Each character of deck represents the value of a card without the suit. The values shown on the card represent the following numerical values: 'A' - 1 '2' - 2 '3' - 3 '4' - 4 '5' - 5 '6' - 6 '7' - 7 '8' - 8 '9' |
| 分类:topCoder |
| 分类:topCoder |
|
一群人晚上过桥,每次只能过2个人,并且需要一盏灯。 给出是过桥时间如{1,2,5,10},计算出最小时间17 首先 1,2 过去 时间 2 总共 17 Problem Statement |
|
| |
A well-known riddle goes like this: Four people are crossing an old bridge. The bridge cannot hold more than two people at once. It is dark, so they can't walk without a |
| 分类:c/c++ |
程序员常常需要实现回调。本文将讨论函数指针的基本原则并说明如何使用函数指针实现回调。注意这里针对的是普通的函数,不包括完全依赖于不同语法和语义规则的类成员函数(类成员指针将在另文中讨论)。
声明函数指针
void f();// 函数原型
上面的语句声明了一个函数,没有输入参数并返回void。那么函数指针的声明方法如下:
void (*) ();
// 获得函数指针的大小
unsigned psize = sizeof (void (*)
| 分类:topCoder |
| 分类:topCoder |
| 分类:c/c++ |
| int checkCPU() { { union w { int a; char b; } c; c.a = 1; return (c.b == 1); } } |
| 内存地址 | 存放内容 |
| 0x4000 | 0x34 |
| 0x4001 | 0x12 |