equal

plt画图工具(二维图形)

我怕爱的太早我们不能终老 提交于 2020-03-23 06:26:13
1.直线图 import numpy as np from matplotlib import pyplot as plt x = np.arange(1,11) y = 2 * x + 5 plt.title("Matplotlib demo") plt.xlabel("x axis caption") plt.ylabel("y axis caption") plt.plot(x,y) plt.grid(True) plt.show() View Code plt.grid设置网格线 2.散点图 plt.scatter(x,y,marker='o',color='r') color 颜色参数 b(blue) g(grenn) r(red) c(cyan) m(magenta) y(yellow) k(boack) w(white) marker 点的图形样式 3.柱状图 plt.bar(x, y, color='green',width=0.8) width柱子的宽度 plt.barh(x,y)垂直的柱状图 4.饼图 plt.pie([5,6,7], labels=['a','b','c'],autopct='%0.f%%',shadow=True) 5.多图形式 import matplotlib.pyplot as plt import numpy as np # Plot

Codeforces Round #619 (Div. 2)_A. Three Strings(C++_模拟)

删除回忆录丶 提交于 2020-02-16 10:04:27
You are given three strings a a a , b b b and c c c of the same length n n n . The strings consist of lowercase English letters only. The i i i -th letter of a a a is a i a_i a i ​ , the i i i -th letter of b b b is b i b_i b i ​ , the i i i -th letter of c c c is c i c_i c i ​ . For every i i i ( 1 ≤ i ≤ n 1 \leq i \leq n 1 ≤ i ≤ n ) you must swap (i.e. exchange) c i c_i c i ​ with either a i a_i a i ​ or b i b_i b i ​ . So in total you’ll perform exactly n n n swap operations, each of them either c i ↔ a i c_i \leftrightarrow a_i c i ​ ↔ a i ​ or c i ↔ b i c_i \leftrightarrow b_i c i ​ ↔ b i

javascript operators(操作符)

怎甘沉沦 提交于 2020-02-15 09:30:06
1.Assignment operators(分配操作) Name Shorthand operator Meaning Assignment x = y x = y Addition assignment x += y x = x + y Subtraction assignment x -= y x = x - y Multiplication assignment x *= y x = x * y Division assignment x /= y x = x / y Remainder assignment x %= y x = x % y Exponentiation assignment x **= y x = x ** y Left shift assignment x <<= y x = x << y Right shift assignment x >>= y x = x >> y Unsigned right shift assignment x >>>= y x = x >>> y Bitwise AND assignment x &= y x = x & y Bitwise XOR assignment x ^= y x = x ^ y Bitwise OR assignment x |= y x = x | y 2.Comparison

Codeforces Round #619 (Div. 2) C题

淺唱寂寞╮ 提交于 2020-02-15 00:39:31
Ayoub’s function Ayoub thinks that he is a very smart person, so he created a function f(s) , where s is a binary string (a string which contains only symbols “0” and “1”). The function f(s) is equal to the number of substrings in the string s that contains at least one symbol, that is equal to “1”. More formally, f(s) is equal to the number of pairs of integers (l,r), such that 1≤l≤r≤|s| (where |s| is equal to the length of string s), such that at least one of the symbols sl,sl+1,…,sr is equal to “1”. For example, if s= “01010” then f(s)=12, because there are 12 such pairs (l,r): (1,2),(1,3),

CMP指令与JCC指令总结

久未见 提交于 2020-02-02 03:02:31
之前看到了cmp指令,总是记混。现在准备对CMP指令和汇编条件的判断做一个简单的总结。 CMP指令 cmp(compare)指令进行比较两个操作数的大小 例:cmp oprd1,oprd2 当执行到CMP指令的时候会读取这两个寄存器的内容,并加以 减法 运算,结果本身不保留,并按照结果设置符号位(属算术运算)。 如何判断大小 若执行指令后:ZF=1,则说明两个数相等,因为zero为1说明结果为0. 当无符号时: 若CF=1,则说明了有进位或借位,cmp是进行的减操作,故可以看出为借位,所以,此时oprd1<oprd2; CF=0,则说明了无借位,但此时要注意ZF是否为0,若为0,则说明结果不为0,故此时oprd1>oprd2. 当有符号时: 若SF=0,OF=0 则说明了此时的值为正数,没有溢出,可以直观的看出,oprd1>oprd2; 若SF=1,OF=0 则说明了此时的值为负数,没有溢出,则为oprd1<oprd2; 若SF=0,OF=1 则说明了此时的值为正数,有溢出,可以看出oprd1<oprd2; 若SF=1,OF=1则说明了此时的值为负数,有溢出,可以看出oprd1>oprd2; 最后两个可以作出这种判断的原因是,溢出的本质问题: 两数同为正,相加,值为负,则说明溢出 两数同为负,相加,值为正,则说明溢出 故有,正正得负则溢出,负负得正则溢出

Day8 - B - Non-Secret Cypher CodeForces - 190D

主宰稳场 提交于 2020-01-22 14:48:02
Berland starts to seize the initiative on the war with Flatland. To drive the enemy from their native land, the berlanders need to know exactly how many more flatland soldiers are left in the enemy's reserve. Fortunately, the scouts captured an enemy in the morning, who had a secret encrypted message with the information the berlanders needed so much. The captured enemy had an array of positive integers. Berland intelligence have long been aware of the flatland code: to convey the message, which contained a number m , the enemies use an array of integers a . The number of its subarrays, in

LeetCode 1007. Minimum Domino Rotations For Equal Row

混江龙づ霸主 提交于 2020-01-16 02:46:21
原题链接在这里: https://leetcode.com/problems/minimum-domino-rotations-for-equal-row/ 题目: In a row of dominoes, A[i] and B[i] represent the top and bottom halves of the i -th domino. (A domino is a tile with two numbers from 1 to 6 - one on each half of the tile.) We may rotate the i -th domino, so that A[i] and B[i] swap values. Return the minimum number of rotations so that all the values in A are the same, or all the values in B are the same. If it cannot be done, return -1 . Example 1: Input: A = [2,1,2,4,2,2], B = [5,2,6,2,3,2] Output: 2 Explanation: The first figure represents the dominoes as

Nodejs断言测试

删除回忆录丶 提交于 2020-01-13 21:00:57
var assert = require('assert'); /*node中,我们可以使用assert模块来测试代码。 equal()和notEqual()分别作相等性和不等性的判断, 第一个参数是期望值,第二个参数是真实值,第三个参数是异常信息*/ // assert.equal(1,2,[console.log('ok')]);//期望值和真实值无论相等还是不相等,输出信息,为什么? // assert.equal(1,2,['not equal']);//期望值和真实值不相等,抛出异常信息 /*ok()方法是比较真值的简洁方法,相当于是用==比较当前值是否为true。*/ // assert.ok('','w');//空格为false // assert.ok('This is a string', 'Strings that are not empty are truthy'); //true assert.ok(0, 'Zero is not truthy');//0为false // assert.fale(1,2,'not equal',console.log('error')); /*node提供了对object对象的比较方法deepEqual() 和 notDeepEqual(), 他们采用下面的步骤比较对象,有一个步骤不匹配就抛出异常: 1.采用===比较;

1060. Are They Equal (25)

谁说胖子不能爱 提交于 2020-01-13 11:59:39
题目连接:https://www.patest.cn/contests/pat-a-practise/1060 原题如下: If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they are both saved as 0.123*10 5 with simple chopping. Now given the number of significant digits on a machine and two float numbers, you are supposed to tell if they are treated equal in that machine. Input Specification: Each input file contains one test case which gives three numbers N, A and B, where N (<100) is the number of significant digits, and A and B are the two float numbers to be compared. Each float number