again

飞机大战游戏

我与影子孤独终老i 提交于 2019-11-29 11:21:42
一、主函数部分 1 import pygame 2 import sys 3 import traceback 4 from pygame.locals import * 5 import myplane 6 import enemy 7 import bullet 8 import supply 9 import random 10 11 pygame.init() 12 bg_size = width, height = 400, 700 13 screen = pygame.display.set_mode(bg_size) 14 pygame.display.set_caption("飞机大战") 15 16 background = pygame.image.load("images/background.png").convert() 17 18 BLACK = (0,0,0) 19 GREEN = (0, 255, 0) 20 RED = (255, 0, 0) 21 WHITE = (255,255,255) 22 23 #载入游戏音乐 24 pygame.mixer.music.load("sound/game_music.ogg") 25 pygame.mixer.music.set_volume(0.2) 26 bullet_sound = pygame

JQuery------库

瘦欲@ 提交于 2019-11-29 06:12:23
JQuery-------------模块、类库 集成了DOM/BOM/JS的类库 一、查找元素   DOM 10左右   JQuery:     选择器:     筛选:   ps:版本:   1.x:兼容性最好。1.12推荐   2.x   3.x 二、操作元素 三、参考的文档和手册:http://jquery.cuishifeng.cn/ 先下载jsquery-1.12.4.js文件,复制到项目中,如图: 下载地址-》》 jquery-1.12.4.js 、 jquery-1.12.4.min.js 在<script></script>中,用jQuery或$加.进行调用: <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title> <link rel="stylesheet" href="cssenjian"/> <!--引用其它样式文件--> <style> /*自编样式*/ </style></head><body> <div id="i1">123</div> <script src="jquery-1.12.4.min.js"></script> <!--引用其它js文件--> <script> //自定义编写的js jQuery $("#i1") /

lightoj 1038 Race to 1 Again 期望

十年热恋 提交于 2019-11-28 14:40:41
dp[i]表示从i到1的期望次数。 dp[i] = ∑dp[j] / cnt + 1。(cnt为所有因子数量,含1和i)但是∑dp[j]中有一个dp[i]。把dp[i]都移项到左侧,得dp[i] = (∑dp[j] - dp[i] + cnt) / (cnt - 1)。提前预处理出来,O(1)回答即可。 1 #include <cstdio> 2 #include <cmath> 3 using namespace std; 4 double dp[100100]; 5 int n,T,cas; 6 int main() 7 { 8 dp[1] = 0; 9 for (int i = 2;i <= 100000;i++) 10 { 11 int t = sqrt(i),cnt = 2; 12 double sum = 0; 13 for (int j = 2;j <= t;j++) 14 if (i % j == 0) 15 { 16 cnt++; 17 sum += dp[j]; 18 if (i / j != j) 19 { 20 cnt++; 21 sum += dp[i / j]; 22 } 23 } 24 dp[i] = (sum + cnt) / (cnt - 1); 25 } 26 for (scanf("%d",&T);T != 0;T--) 27 { 28 cas

树_A1086 Tree Traversals Again (25 分)

核能气质少年 提交于 2019-11-28 00:26:39
/* 先序序列区间[preL,preR] 中序序列区间[inL,inR] 左子树的结点个数numLeft=k-inL 左子树的先序[preL+1,preL+numLeft] 左子树的中序[inL,k-1] 右子树的先序[preL+numLeft+1,preR] 右子树的中序[k+1,inR] */ #include<cstdio> #include<cstring> #include<stack> #include<algorithm> using namespace std; const int maxn=50; struct node{ int data; node* lchild; node* rchild; }; int pre[maxn],in[maxn],post[maxn]; int n;//结点个数 node* create(int preL,int preR,int inL,int inR){ if(preL>preR){ return NULL; } node* root=new node; root->data=pre[preL];//新结点的数据域为根结点的值 int k; for(k=inL;k<=inR;k++){ if(in[k]==pre[preL]){ break; } } int numLeft=k-inL;//左子树的结点个数 root-