Problem G Power et al. Input: Standard Input Output: Standard Output Finding the exponent of any number can be very troublesome as it grows exponentially J. But in this problem you will have to do a very simple task. Given two non-negative numbers m …
Problem B Number Sequence Input: standard input Output: standard output Time Limit: 1 second A single positive integer i is given. Write a program to find the digit located in the position i in the sequence of number groups S1S2…Sk. Each group Sk con…
打出SG表来可以很容易的发现i为偶数时 SG[i]=i/2 i为奇数时 SG[i]=SG[i/2] #include<bits/stdc++.h> typedef long long ll; using namespace std; ll SG(ll x) { ?SG(x/):x/; } int main() { int t; scanf("%d", &t); while (t--) { int n; ll a, v = ; scanf("%d"…
Swap There is a sequence of numbers of length nn, and each number in the sequence is different. There are two operations: Swap the first half and the last half of the sequence (if nn is odd, the middle number does not change) Swap all the numbers in…
) while exists (select name from sys.tables where name like 'se_%') begin @varname = name from sys.tables where name like N'se_%' exec (N'drop table '+@varname) end 查询出某种规律的表,并删除…
逐渐发现找规律的美妙之处啦,真不错,用普通方法解决很久或者很麻烦的问题,找到规律就很方便,算法最主要还是思想 Description There are another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2). Input Input consists of a sequence of lines, each containing an integer n. (n < 1,…
Number Sequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 175657 Accepted Submission(s): 43409 Problem Description A number sequence is defined as follows: f(1) = 1, f(2) = 1, f(n) = (A…
取(2堆)石子游戏 Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2622 Accepted Submission(s): 1594 Problem Description 有两堆石子,数量任意,可以不同.游戏开始由两个人轮流取石子.游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子:二是可以在两堆中同时取走相…
一 单表查询 表准备 create table emp( id int not null unique auto_increment, name varchar(20) not null, sex enum('male','female') not null default 'male', #大部分是男的 age int(3) unsigned not null default 28, hire_date date not null, post varchar(50), post_comment…
一.语法 表的查询一般使用select关键字,配合where筛选.顺序如下: # 先后顺序 from where select 二.where约束条件 首先先建立表: create table emp( id int not null unique auto_increment, name ) not null, sex enum('male','female') not null default 'male', #大部分是男的 age ) unsigned , hire_date date n…
一.多表查询 #建表 create table dep( id int, name varchar(20) ); create table emp( id int primary key auto_increment, name varchar(20), sex enum('male','female') not null default 'male', age int, dep_id int ); #插入数据 insert into dep values (200,'技术'), (201,'人…
单表查询 前期表准备 create table emp( id int not null unique auto_increment, name varchar(20) not null, sex enum('male','female') not null default 'male', #大部分是男的 age int(3) unsigned not null default 28, hire_date date not null, post varchar(50), post_comment…
语法执行顺序 from >>>从那张表 where >>> 全局的筛选条件 group by>>> 必须是用在where 之后一组就是为了接下来我们的查询进一步缩小范围 缩小到具体的分组如select * from techer inner join course on tescher.tid=course.teacher_id group_by curse_id 连表之后以课程表中的course_id 字段进行再次分组 可以 为我们进行其条件的查询提…
今日内容: 一.单表查询 1.语法执行顺序 2.where约束条件 3.group by 4.having 5.distinct 6.order by 7.limit 8.正则 二.多表查询 1.表查询 2.子查询 表(下面用的都是该表): create table emp( id int not null unique auto_increment, name varchar(20) not null, sex enum('male','female') not null default 'm…
一.表的基本查询语句及方法 from. where. group by(分组).having(分组后的筛选).distinct(去重).order by(排序). limit(限制) 1.单表查询: 先创建表,数据量稍微多点的表 create table emp( id int not null unique auto_increment, # 和设主建同理 forgeing key name varchar(20) not null, sex enum('male','femlae') no…
单表查询 表准备 create table emp( id int not null unique auto_increment, name ) not null, sex enum('male','female') not null default 'male', #大部分是男的 age ) unsigned , hire_date date not null, post ), post_comment ), salary ,), office int, #一个部门一个屋子 depart_id…