本题解与Luogu同步 Solution 把长和宽分解,之后相乘看结果 可以定义一个函数实现分解,采用递推的形式 然后一个while循环实现 #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using ...
分类:
其他好文 时间:
2021-01-12 10:36:21
阅读次数:
0
public class Beersong { public static void main (String[] args){ int beernum =99; String word = "bottle"; while (beernum>0){ if (beernum == 1){ word = ...
分类:
其他好文 时间:
2021-01-11 11:17:35
阅读次数:
0
1.生成器 根据程序员制定的规则循环生成数据,当条件不成立时则生成数据结束。数据不是一次性全部生成处理,而是使用一个,再生成一个,可以节约大量的内存。 两种方式创建生成器 生成器推导式 yield 关键字 2.生成器推导式方式创建生成器: 与列表推导式类似,只不过生成器推导式使用小括号 # 创建生成 ...
分类:
编程语言 时间:
2021-01-11 10:47:14
阅读次数:
0
这题要求 找到涂色骰子是否为相同的骰子 使用函数式编程的思想,对于第二个骰子 ,每一个面,判断将其左右旋转后能否满足第一个骰子,旋转的任务交给函数rotate去做, 而换面的操作交给f1和f2去做 #include<iostream> #include<string> using std::cin; ...
分类:
其他好文 时间:
2021-01-11 10:42:34
阅读次数:
0
给定一个按照升序排列的整数数组 nums,和一个目标值 target。找出给定目标值在数组中的开始位置和结束位置。 如果数组中不存在目标值 target,返回?[ 1, 1]。 进阶: 你可以设计并实现时间复杂度为?O(log n)?的算法解决此问题吗? 示例 1: 输入:nums = [5,7,7 ...
分类:
编程语言 时间:
2021-01-08 11:34:24
阅读次数:
0
冒泡排序 1 void BubbleSort(ElementType A[], int N) { 2 ElementType temp; 3 for(int i=0; i<N; i++) { 4 for(int j=0; j<N-i-1; j++) { // 关键点在与j<N-i-1,生成一个升序的 ...
分类:
编程语言 时间:
2021-01-08 11:33:42
阅读次数:
0
显示百分比 import sys import time n = 1 while n <= 100: sys.stdout.write('{}{:.0f}%\r'.format('*' * n, float(n / 100) * 100)) if n == 100: sys.stdout.write ...
分类:
编程语言 时间:
2021-01-08 10:51:26
阅读次数:
0
显示百分比 import sys import time n = 1 while n <= 100: sys.stdout.write('{}{:.0f}%\r'.format('*' * n, float(n / 100) * 100)) if n == 100: sys.stdout.write ...
分类:
编程语言 时间:
2021-01-08 10:50:22
阅读次数:
0
listview1.clear; with adoquery1 do begin Sql.text := 'Select * from table1'; Open ; while not eof do begin with listview1.items.add do begin caption : ...
分类:
数据库 时间:
2021-01-08 10:39:50
阅读次数:
0
1、 #include <stdio.h> int main(void) { int i; do { puts("please input an integer."); printf("i = "); scanf("%d", &i); } while (i <= 0); while (i > 0) ...
分类:
编程语言 时间:
2021-01-08 10:28:25
阅读次数:
0