winner

SQLZOO练习

懵懂的女人 提交于 2020-03-26 00:06:45
1.select Basics 1.Modify it to show the population of Germany SELECT population FROM world WHERE name ='Germany' 2.Show the name and the population for 'Sweden', 'Norway' and 'Denmark'. SELECT name,population FROM world WHERE name in ('Sweden','Norway','Denmark') 3. Modify it to show the country and the area for countries with an area between 200,000 and 250,000. SELECT name,area FROM world WHERE area BETWEEN 200000 AND 250000 2.SELECT from WORLD Tutorial 1.Read the notes about this table. Observe the result of running this SQL command to show the name, continent and population of all

井字游戏代码

我们两清 提交于 2020-02-17 15:05:44
#include<stdio.h> #include<stdlib.h> #include<stdbool.h> int main() { unsigned int player = 0; unsigned int xia = 0; bool winner = 0; unsigned int row = 0; unsigned column = 0; //定义棋子 char qizi[3][3] = { {‘1’,‘2’,‘3’},{‘4’,‘5’,‘6’},{‘7’,‘8’,‘9’} }; for (unsigned int i = 0; i < 9 && winner == 0; ++i) { //1,设定选手号 player = i % 2 + 1; //2,打印棋局,选手下棋,下的不对继续下,并检验赢家 do { printf(" %c | %c | %c \n", qizi[0][0], qizi[0][1], qizi[0][2]); printf("---+---+---\n"); printf(" %c | %c | %c \n", qizi[1][0], qizi[1][1], qizi[1][2]); printf("---+---+---\n"); printf(" %c | %c | %c \n", qizi[2][0], qizi[2][1], qizi

多线程06:龟兔赛跑

元气小坏坏 提交于 2020-02-04 19:11:44
案例:龟兔赛跑-Race 1、首先来个赛道的距离,然后要离终点越来越近 2、判断比赛是否结束,结束就来看下谁胜利了 3、胜利后,打印出胜利者 4、龟兔赛跑开始,相当于两条线程开始跑了,看谁先到最后一步 5、然后,因为故事中是乌龟赢的,兔子要睡觉,所以我们来模拟兔子睡觉 6、最后,乌龟赢得了比赛 实现了Runnable接口,共享一条跑道。丢入Thread代理对象,调用start()方法开启两个线程代表兔子和乌龟,让兔子每10步并且隔10ms睡一觉,让乌龟赢。 1 package com.thread.demo01; 2 3 //模拟龟兔赛跑 4 public class Race implements Runnable { 5 6 //胜利者 7 private static String winner; 8 9 @Override 10 public void run() { 11 for (int i = 0; i <= 100; i++) { 12 13 //模拟兔子休息,每10步休息10毫秒 14 if (Thread.currentThread().getName().equals("兔子") && i % 10 == 0) { 15 try { 16 Thread.sleep(10); 17 } catch (InterruptedException e) { 18 e

SQL学习(二)——SELECT COUNT GROUP BY HAVING

你。 提交于 2020-01-31 00:35:07
select within select 2020/01/30 https://sqlzoo.net/wiki/SELECT_within_SELECT_Tutorial/zh 2. 列出歐州每國家的人均GDP,當中人均GDP要高於英國’United Kingdom’的數值。 SELECT name FROM world WHERE continent = 'Europe' and gdp / population > ( SELECT gdp / population FROM world WHERE name = 'United Kingdom' ) 3. 在阿根廷Argentina 及 澳大利亞 Australia所在的洲份中,列出當中的國家名字 name 及洲分 continent 。按國字名字順序排序 select name , continent from world where continent in ( select continent from world where name = 'Argentina' or name = 'Australia' ) 5.Germany德國(人口8000萬),在Europe歐洲國家的人口最多。Austria奧地利(人口850萬)擁有德國總人口的11%。 顯示歐洲的國家名稱name和每個國家的人口population

c++11新特性之atomic

百般思念 提交于 2020-01-24 04:32:29
std::atomic_flag   std::atomic_flag是一个原子的布尔类型,可支持两种原子操作: test_and_set, 如果atomic_flag对象被设置,则返回true; 如果atomic_flag对象未被设置,则设置之,返回false clear. 清楚atomic_flag对象   std::atomic_flag可用于多线程之间的同步操作,类似于linux中的信号量。使用atomic_flag可实现mutex. #include <iostream> #include <atomic> #include <vector> #include <thread> #include <sstream> std::atomic_flag lock = ATOMIC_FLAG_INIT; std::stringstream stream; void append_numer(int x) { while (lock.test_and_set()); stream << "thread#" << x << "\n"; lock.clear(); } int main() { std::vector<std::thread> ths; for (int i=0; i<10; i++) ths.push_back(std::thread(append_numer, i

A. Winner

与世无争的帅哥 提交于 2020-01-14 19:45:36
链接: https://codeforces.com/contest/2/problem/A The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the winner. The situation becomes more difficult if the number of such players is more than one. During each round a player gains or loses a particular number of points. In the course of the game the number of points is registered in the line "name score", where name is a player's name, and score is the number of points gained in this round, which is

在linux下成功写Bingo游戏

时光怂恿深爱的人放手 提交于 2020-01-13 13:40:27
帮一个外国友人完成他的小作业 •Bingo is a game of chance in which each player matches numbers printed in different arrangements on cards which the numbers the game host (caller) draws at random, marking the selected numbers with tiles one at a time. •When a player finds the selected numbers are arranged on their card in a row (horizontal or vertical or diagonal), they call out “Bingo!” to alert all participants to a winning card •Caller: 2, 9, 12, 5, 11, 8 (Player 1 wins) A bingo board has mrows and mcolumns. Each entry has a different number from 1 to m×m. ●The numbers from 1 to m×mwill be randomly called.

SQLZOO 习题

こ雲淡風輕ζ 提交于 2019-12-27 01:17:47
https://sqlzoo.net 8. 美國、印度和中國(USA, India, China)是人口又大,同時面積又大的國家。排除這些國家。 顯示以人口或面積為大國的國家,但不能同時兩者。顯示國家名稱,人口和面積。 (成為大國的兩種方式:如果它有3百萬平方公里以上的面積,或擁有250百萬(2.5億)以上人口) SELECT `name`, `population`, `area` FROM `world` WHERE (area>3000000 AND population<250000000) OR (area<3000000 AND population>250000000)  9. 除以為1000000(6個零)是以百萬計。除以1000000000(9個零)是以十億計。使用 ROUND 函數來顯示的數值到小數點後兩位。 對於南美顯示以百萬計人口,以十億計2位小數GDP。 SELECT `name`, ROUND(population/1000000,2) AS population, ROUND(gdp/1000000000,2) AS gdp FROM `world` WHERE `continent`='South America'  10. 顯示國家有至少一個萬億元國內生產總值(萬億,也就是12個零)的人均國內生產總值。四捨五入這個值到最接近1000。

java多线程模拟龟兔赛跑

删除回忆录丶 提交于 2019-12-23 17:40:42
让乌龟和兔子在同一个赛道从1开始跑到100,看看谁更快. 1 public class Racer implements Runnable{ 2 private static String winner;//胜利者 3 4 @Override 5 public void run() { 6 //赛道 7 for (int step = 1; step <= 100; step++) { 8 /* if(Thread.currentThread().getName().equals("兔子")&&step%50==0){ 9 try { 10 Thread.sleep(200); 11 } catch (InterruptedException e) { 12 e.printStackTrace(); 13 } 14 }*/ 15 System.out.println(Thread.currentThread().getName()+"---->走了"+step+"步"); 16 17 boolean flag= GameOver(step); 18 if(flag){ 19 break; 20 } 21 22 } 23 } 24 25 private boolean GameOver(int step) { 26 if(winner!=null){ 27 return true;

【SQL】sqlzoo练习题The nobel table can be used to practice more subquery.

蓝咒 提交于 2019-12-11 02:19:34
原地址: https://sqlzoo.net/wiki/The_nobel_table_can_be_used_to_practice_more_subquery./zh 上一篇: sqlzoo练习题SELECT within SELECT Tutorial 1.紅十字國際委員會 (International Committee of the Red Cross) 曾多次獲得和平獎。 試找出與紅十字國際委員會同年得獎的文學獎(Literature)得獎者和年份。 nobel(yr, subject, winner) SELECT winner , yr FROM nobel where subject = 'Literature' and yr in ( select yr from nobel where winner = 'International Committee of the Red Cross' and subject = 'Peace ' ) --解题思路:因为获奖可能不止一次,所以年份可能不唯一。这里需要用in 2.日本物理學家益川敏英 (Toshihide Maskawa) 曾獲得物理獎。同年還有兩位日本人一同獲得物理獎。試列出這2位日本人的名稱。 nobel(yr, subject, winner) select winner from nobel