Tri Tiling

In how many ways can you tile a 3×n rectangle with 2×1 dominoes? Here is a sample tiling of a 3×12 rectangle. InputInput consists of several test cases followed by a line containing −1−1. Each test case is a line containing an integer 0≤n≤300≤n≤30.Output For each test case, output one integer number giving the number of possible tilings. #include<iostream> #include<algorithm> #include<cstdio> #include<cstring> using namespace s ...

李白打酒

话说大诗人李白,一生好饮,幸好他从不开车。一天,他提着酒壶,从家里出来,酒壶中有酒 2 斗,他边走边唱:无事街上走,提壶去打酒。逢店加一倍,遇花喝一斗。这一路上,他一共遇到店 mm 次,遇到花 nn 次,已知最后一次遇到的是花,他正好把酒喝光了。请你计算李白遇到店和花的次序,可以把遇店记为 aa,遇花记为 bb。例如:这一路上,他一共遇到店 55 次,遇到花 1010 次,已知最后一次遇到的是花,他正好把酒喝光了。则:babaabbabbabbbb 就是合理的次序。像这样的答案 ...

Mooc视频下载器

原文地址:金君 下载链接:64位机 32位机 使用方式: 下载你所需要的对应的exe直接运行。输入你所需要的视频名称或者视频的网址链接。 然后选择在搜索到的课程名称前面对应的id,然后会提示选择视频清晰度。 最后将会在exe同一级目录下生成文件夹。 附代码: ''' 慕课视频下载器 ''' import sys import os import re import json from time import clock, sleep from socket import timeout from urllib import request from urllib import parse from urllib.error import ContentTooShortError, URLError, ...

B – Who’s in the Middle

  B – Who’s in the Middle FJ is surveying his herd to find the most average cow. He wants to know how much milk this ‘median’ cow gives: half of the cows give as much or more than the median; half give as much or less. Given an odd number of cows N (1 <= N < 10,000) and their milk output (1..1,000,000), find the median amount of milk given such that at least half the cows give the same amount of milk or more and at least half give the same or less. Input * ...

A – All in All

  A – All in All You have devised a new encryption technique which encodes a message by inserting between its characters randomly generated strings in a clever way. Because of pending patent issues we will not discuss in detail how the strings are generated and inserted into the original message. To validate your method, however, it is necessary to write a program that checks if the message is really encoded in the final string. Given two strings s and t, you have to decide whethe ...

linux下多线程多进程pthread的使用以及理解

word文档:点击此处进行下载 一些函数的具体用法就不明说了,只做一些核心的解释 下面直接贴代码: pthread_create():创建一个线程   /* thread_create.c */ #include<stdio.h> #include<stdlib.h> #include<pthread.h> /* 线程函数1 */ void *mythread1(void){ int i; for(i=0;i<5;i++){ printf("I am the 1st pthread,created by mybeilef321\n"); sleep(2); } } /* 线程函数2 */ void *mythread2(void){ int i; ...

CodeBlock安装后无法运行为什么?无法找到编译器?

安装完codlblocks后常会出现以下警告:cant find compiler executable in your configured search paths for GNU GCC Compiler 提示给出的路径无法找到编译器。 注意:CodeBlock只是一个IDE(集成开发环境,Integrated Development Environment),其编译器一般是mingw或GCC(TDM-GCC),Codeblock分为带编译器的安装程序,和不带编译器的安装程序。 可以下载自带编译器的codeblocks,否则得先安装一个编译器(例如,GCC编译器)才能将该编译器加载到codeblocks. 安装之后在Code::Blocks的菜单中点击Settings->Compiler,如果安装了 ...