This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //https://www.luogu.com.cn/problem/P13841 | |
| //思路:找到所有的HI和HE,HE每变化一次就会在它前方增加一个S,HI根据它后面的字符决定它的开始变化时机,一旦开始变化后就是HIS->HER->SHER->SSHER | |
| //当它的后面是s,那么就是从第1次开始变化,后面是he就是从第二次开始变化,后面是hi就是它后面的hi变化时机+2 | |
| //对于一次查询请求k与x,从最左侧的hi/he开始,如果经过K次变化后,hi/he扩展后的长度覆盖了x,那么就从这个扩展后hi/he找到第X位的字符 | |
| #include<cstdio> | |
| #include<vector> | |
| #include<algorithm> | |
| #define TYPE_HE 0 | |
| #define TYPE_HI 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.mockito.exceptions.base.MockitoException; | |
| import org.mockito.internal.verification.VerificationModeFactory; | |
| import org.mockito.internal.verification.api.VerificationData; | |
| import org.mockito.internal.verification.api.VerificationDataInOrder; | |
| import org.mockito.internal.verification.api.VerificationInOrderMode; | |
| import org.mockito.invocation.Invocation; | |
| import org.mockito.invocation.MatchableInvocation; | |
| import org.mockito.verification.VerificationMode; | |
| import java.util.ArrayList; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'socket' | |
| PORT = 12321 | |
| def process_message(message,packet_info) | |
| message = Marshal.load(message) | |
| case message[:type] | |
| when :broadcast | |
| return reply_broadcast(message,packet_info) | |
| when :reply | |
| return deal_reply(message,packet_info) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #TODO 应该将每个点数组抽象成图形,然后实现normalize!以及rot方法 | |
| #fuck it, it works. | |
| class Point | |
| attr :x,true | |
| attr :y,true | |
| attr :z,true | |
| def hash | |
| x<<16|y<<8|z | |
| end | |
| def ==(o) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Inspired by http://www.zhihu.com/question/20125963/answer/18158192 (chinese) | |
| #include<stdio.h> | |
| #include<stdlib.h> | |
| #define MAXN 5 | |
| typedef void* (*loop_func)(void* params); | |
| typedef void (*branch)(loop_func,void*); | |
| void conditionFalse(loop_func loopfunc,void* params){ | |
| (*loopfunc)(params); | |
| } | |
| void conditionTrue(loop_func loopfunc,void* params){ |