 Play with Sequence

Problem Description
ivankevin loves sequences.
A sequence of n elements is called a SWITCH SEQUENCE iff:
Each element is a 2switch, where a 2switch is the replacement of a pair of edges xy & zw in a simple graph by the edges yz and wx, given that yz and wx did not appear in the graph originally.
Now give two simple graphs G and H with same vertex set V, ivankevin wants to know whether there is a switch sequence transforms G into H.Input
There are multiple test cases.
Each case contains 1 + 2n lines. The positive integer n(0<n<101) is given in the first line. The next 2n lines are the matrix which describe the two graphs G and H. The j elements in the i rows is either 0 or 1. If the node i and the node j has a edge in the graph. The elements will be 1. Otherwise is 0. It’s guaranteed that the matrix is symmetry and the i elements in the i row is always 0. See sample input for more details.Output
For each case, first output an integer L in a line, which should represent the length of the switch sequence you found.
If no switch sequence can transform G into H, then you should print L as 1 and no more lines. Otherwise output L lines follow. Each of the L lines should contains four distinct integers x, y, z and w, indicating a 2switch on G, as described.
For some reason, if L is equal to or larger than 1000000, ivankevin would think the switch sequence you found is so ugly that it is ungelieveble and unacceptable. Otherwise, if L < 1000000 and the sequence finally transform G into H, he will accept your answer.Sample Input
4
0 1 0 0
1 0 0 0
0 0 0 1
0 0 1 0
0 0 1 0
0 0 0 1
1 0 0 0
0 1 0 0
4
0 1 0 0
1 0 0 0
0 0 0 1
0 0 1 0
0 1 1 0
1 0 0 0
1 0 0 0
0 0 0 0Sample Output
1
0 1 3 2
1
Let's play UNO 怎么实现的_course
20191228Problem Description Uno is a famous card game played with a specially printed deck. It's very popular as a funny game in a party. A socalled "official rules" is presented at the Wikipedia, but there are a lot of different extended rules all over the world according to their specific needs. In this problem, you are required to obey our rules introduced below: The Uno deck consists of cards of 4 colors: red(R), green(G), blue(B), and yellow(Y). Each color has two kinds of cards, number cards and action cards. The ranks in number cards are 09. There are 3 "action" cards in each color, labeled "skip"(S), "draw two"(D), and "reverse"(R). The functions of the actions will be described afterwards. For each color, there are two copies of each positive number card and action card, but only one zero card, producing 25 cards in total. Besides, there are also special black action cards called "wild cards", "wild"(WC) and "wild draw four"(WF). There are four "wild" and "wild draw four" cards each. Hence, there are 108 cards in total. In this problem, a card is marked with an ID of two characters length, the first is the color (R, G, B, Y, W) while the second is the rank (09, S, D, R, C, F). For example, the ID of red 2 is R2, the yellow reverse is YR, the wild cards are WC and WF. Supposed there are n players numbered from 1 to n clockwise. Before playing, players take turns(in the order of 1, 2, ... n) to pick seven successive cards from the stock. The top card of the remaining stock is exposed to start the game, treated as if player 1 dropped that card. The exposed card will never be WC or WF in this problem. Then the game begins clockwise (next player is 2), or counterclockwise (next player is n) if the top exposed card is a reverse. At each turn, a player may drop a card from their hand that matches the color or rank of the top exposed card (e.g., if the top card is R3, you can drop R5 or G3; if the top card is RD, you can drop R3 or GD) or play a WC. What's more, if the player has a WF and no other legal cards to drop, he can drop the WF. Then the card dropped just now becomes the top exposed card. If a player has no legal cards, he must draw the top card of the stock and place it in his hand. After dropping a single card or drawing, the next player clockwise takes a turn, or counterclockwise when the reverse is in effect. When a player drops down to only one card, that player is required to say "uno" to warn other players. The game ends when a player drops all his/her cards, or the stock is emptied but the current player has to draw a card. If the last card is an action card, the special effect still occurs. When the game ends, all players count the number of points pertaining to the values of the cards in their hands. Number cards worth the face value on them, colored special cards worth twenty, and wilds worth fifty, e.g., R2 worth 2, G0 worth 0, BD and YS worth 20, WC and WF worth 50. The descriptions of the action cards: Now here comes the problem. There are N people playing Uno under the rules mentioned above. Given the sequence of the 108 cards of the stock, you are asked to simulate a Uno game. At each turn, the player will always drop a card if permitted. If there are more than one choices, the player will drop the card with the largest point. If still a tie, he will choose the one whose ID is the smallest alphabetical order. When a player drops WC or WF, he has to name a color. The first time he will name red, the second time he will name green, the third time blue, the fourth time yellow, the fifth time red again, and so on. When the game ends, you should output the final score of each player, and we also want to know how many times each player calls "Uno". Input The first line of the input file contains a single number: the number of test cases to follow. Each test case has two lines: The first line contains the number of players N , with 2<=N<=10. The second line contains 108 IDs of the Uno cards, separated by one space. Each ID is two characters long as introduced in the description above. Output For each test case, output two lines: The first line are N integers, the ith integer is the final score of player i. The second lines are also N integers, the ith integer shows how many times player i calls "Uno". Sample Input 1 2 R9 RD RD RS RS RR RR B0 B1 B1 B2 B2 B3 B3 G0 GD GD GS GS GR GR G9 G9 G8 G8 G7 G7 G6 G6 G5 G5 G4 G4 G3 G3 G2 G2 G1 G1 Y0 Y9 Y9 Y8 Y8 Y7 Y7 Y6 Y6 Y5 Y5 Y4 Y4 Y3 Y3 Y2 Y2 Y1 Y1 YD YD YS YS YR YR R9 R8 R8 R7 R7 R6 R6 R5 R5 R4 R4 R3 R3 R2 R2 R1 R1 R0 B4 B4 B5 B5 B6 B6 B7 B7 B8 B8 B9 B9 BD BD BS BS BR BR WC WC WC WC WF WF WF WF Sample Output 249 0 0 1
Partition a Matrix _course
20171017Description Given an M * N matrix consisted of nonnegative elements, you may partition it into three parts with two straight line segments. The line segments cannot go through any element of the matrix and they must be parallel to the row or the column of the matrix, but they need not to be parallel to each other. Each of the three parts is a nonempty matrix, which means it contains at least one element. We define the value of a matrix as the sum of all elements in it. We denote the values of the three remaining matrices as X, Y, Z, and the balance degree as X  Y + Y  Z + Z  X, where . means the absolute value. Among all ways of partition, there is one, which has the least balance degree. Your task is to decide what the least balance degree is. Input The input will consist of several test cases. For each test case, two integers M and N are given in the first line, indicating the number of rows and columns of the matrix; each of the following M lines contains N integers, indicating the matrix. The input is terminated by a single line with two zeros. You may assume that 2 <= M, N <= 500 and all elements of the matrix are integers in the range [0, 65535]. There may be some blank lines between test cases. Output For each matrix of the input, print a line containing the least balance degree. Sample Input 3 3 9 8 7 6 5 4 3 2 1 0 0 Sample Output 10
帮忙看看这个程序出了什么问题_course
20170913本菜写了一个小程序 能够创建一个矩阵，规定长宽，并进行矩阵之间的加减运算 代码如下 ``` #include<iostream> using namespace std; class matrix //创建矩阵类 { private: int lines; int rows; int **num; //建立二重数组 public: matrix(int a,int b) //构造函数 { lines=a; rows=b; cout<<"矩阵初始化"<<endl; num=new int*[lines]; int x,y; for(y=0;y<lines;y++) { num[y]=new int[rows]; //循环完成new申请内存 } } /*matrix(matrix& father) //拷贝构造函数 { cout<<"调用拷贝构造函数"<<endl; lines=father.lines; rows=father.rows; int x,y; for(y=0;y<lines;y++) { for(x=0;x<rows;x++) { num[x][y]=father.num[x][y]; //循环读入矩阵元素 } } }*/ void in(); //输入函数 void out(); //输出函数 int get_num(int x,int y) //取用指定元素的函数（内联） { return num[x][y]; } void operate(int mode,matrix m1,matrix m2); //运算函数，包含加和减 ~matrix() //析构函数 释放矩阵空间 { } void matrix_free(); //释放矩阵空间函数 }; void matrix::matrix_free() { int i; for(i=0;i<lines;i++) { delete []num[i]; } delete []num; } void matrix::in() { cout<<"请按顺序输入矩阵元素:"<<endl; int x,y; for(y=0;y<lines;y++) { for(x=0;x<rows;x++) { cin>>num[x][y]; //循环输入矩阵元素 } } } void matrix::out() //此函数可以按格式输出矩阵 { int x,y; for(y=0;y<lines;y++) { for(x=0;x<rows;x++) { cout<<num[x][y]; if(x!=rows1) { cout<<" "; } } cout<<endl; } } void matrix::operate(int mode,matrix m1,matrix m2) //运算函数，mode=1代表加，mode=1代表减，m1,m2为待处理矩阵 { int x,y; for(y=0;y<lines;y++) { for(x=0;x<rows;x++) { num[x][y]=m1.get_num(x,y)+mode*m2.get_num(x,y); //运算部分 } } } int main(void) { int a=0,b=0; cout<<"输入矩阵大小（行 列）:"<<endl; while(a<=0b<=0) { cin>>a>>b; if(a<=0b<=0) { cout<<"输入错误,重新输入:"<<endl; } } matrix A1(a,b),A2(a,b),A3(a,b); //创建三个矩阵 A1.in(); //输入初始化 A2.in(); A3.operate(1,A1,A2); //A3=A1+A2 cout<<"矩阵和："<<endl; A3.out(); //输出 A3.operate(1,A1,A2); //A3=A1A2 cout<<"矩阵差："<<endl; A3.out(); //输出 A1.matrix_free(); //释放矩阵空间 A2.matrix_free(); A3.matrix_free(); } ``` 此程序目前问题有三个 1.拷贝构造函数出错，只能注释掉，否则输入完两个矩阵后回车程序未响应 2.释放矩阵空间的不能写在析构函数里，否则输出结果不正确（A3=A1A2的最后一行） 3.输入矩阵的列不能大于行，否则输入完第一行数字并回车后程序未响应 请前辈指导，谢谢
Matrix Multiplication 矩阵乘法_course
20161226Description Many studies have been done on developing efficient algorithms to calculate matrix multiplication. But it remains as a hard topic today. In this problem you are to calculate the 2006th power of a square Boolean matrix where addition and multiplication are defined as follows: A B A + B 0 0 0 0 1 1 1 0 1 1 1 1 Truth Table of Addition A B AB 0 0 0 0 1 0 1 0 0 1 1 1 Truth Table of Multiplication Let A be a square matrix. The zeroth power of A is the identity matrix. The nth (n > 0) power of A is the product of A and its (n − 1)th power. Input The input contains multiple test cases. Each test cases consists of some lines: Line 1: Contains two integers K (K < 1000) and M (0 ≤ M ≤ 10K), indicating the dimension of the matrix is K × K and K + M elements of the matrix are 1’s. Lines 2 ~ M + 1: Each contains two integers i and j (0 ≤ i, j < K, i ≠ j), indicating the element in the (i + 1)th row and (j + 1)th column is 1. All elements on the primary diagonal of the matrix are 1’s. Output For each test case output one line containing the number of elements that are 1’s in the 2006th power of the given matrix. Sample Input 3 4 1 2 2 1 0 1 0 2 Sample Output 7
Matrix Searching _course
20170411Given an n*n matrix A, whose entries Ai,j are integer numbers ( 1 <= i <= n, 1 <= j <= n ). An operation FIND the minimun number in a given ssubmatrix. Input The first line of the input contains a single integer T , the number of test cases. For each test case, the first line contains one integer n (1 <= n <= 300), which is the sizes of the matrix, respectively. The next n lines with n integers each gives the elements of the matrix. The next line contains a single integer N (1 <= N <= 1,000,000), the number of queries. The next N lines give one query on each line, with four integers r1, c1, r2, c2 (1 <= r1 <= r2 <= n, 1 <= c1 <= c2 <= n), which are the indices of the upperleft corner and lowerright corner of the submatrix in question. Output For each test case, print N lines with one number on each line, the required minimum integer in the submatrix. Sample Input 1 2 2 1 2 3 2 1 1 2 2 1 1 2 1 Sample Output 1 2
Evaluate Matrix Sum _course
20170628Given a matrix, the elements of which are all integer number from 0 to 50, you are required to evaluate the square sum of its specified submatrix. Input The first line of the input contains a single integer T (1 <= T <= 5), the number of test cases. For each test case, the first line contains two integers m and n (1 <= m, n <= 500), which are the row and column sizes of the matrix, respectively. The next m lines with n numbers each gives the elements of the matrix. The next line contains a single integer N (1 <= N <= 100,000), the number of queries. The next N lines give one query on each line, with four integers r1, c1, r2, c2 (1 <= r1 <= r2 <= m, 1 <= c1 <= c2 <= n), which are the indices of the upperleft corner and lowerright corner of the submatrix in question. Output For each test case, first print the number of the test case, then N lines with one number on each line, the required square sum. Refer to the sample output for details. Sample Input 2 2 3 1 2 3 4 5 6 2 1 1 2 2 1 3 2 3 3 3 4 2 3 2 5 1 7 9 2 1 1 1 3 3 Sample Output Case 1: 46 45 Case 2: 193
ACM 省赛题 求算法_course
20120522(1) Magic Sequence Ivankevin loves sequences. A sequence of n + m elements is called a MAGIC SEQUENC
Direct Subtraction _course
20170228Statement of the Problem Some algorithms on image processing are more efficient when applied to small patterns, such as 3 x 3 matrices. One way of decomposing a given figure into small components is to apply the operation of direct subtraction, which is described in the following. Given a 0/1 matrix Amxm and a 0/1 matrix B3x3 we define the matrix C(m2)x(m2) = A  B obtained in the following way: We call matrix C a valid direct subtraction of B from A if for every aij = 1 in matrix A, there is a 1 in matrix C which results from a subtraction of B from a submatrix of A containing aij, and the element of B which is subtracted from aij is equal to 1. Example: Given matrices A and B, the direct subtraction C = A  B is valid and is given by Now, given matrices A and B, The direct subtraction C = A  B is not valid and is given by The objective of this problem is to determine if a matrix A can be transformed into a 3 x 3 matrix through a sequence of valid direct subtractions of, possibly different, 3 x 3 matrices. Input Format Several input instances are given. Each instance begins with the dimension 0 < n < 20 of the matrix to be decomposed. The following n lines describe the rows of that matrix, as a sequence of n 0's and 1's, with no blank spaces between them. The input ends with a line with a single 0. Output Format For each input instance your program must identify it by printing Instance i: (where i is the number of the instance) and, in the next line a message Yes or No for the case, resp. that the matrix is (resp. is not) decomposable. Sample Input 5 01010 11111 01111 00111 00010 5 10001 00000 00100 00000 10001 0 Sample Output Instance 1: Yes Instance 2: No
Lines _course
20170928Problem Description You play a game with your friend. He draws several lines on the paper with n×m square grids (see the left figure). After that, he writes down the number of lines passing through every integer coordinate in a matrix (see the right figure). ![](http://acm.hdu.edu.cn/data/images/C53510101.jpg) The number of lines passing though coordinate (i,j) is written in cell (i,j) in the right figure.(i,j both start from 0). You are given the matrix written by your friend. You need to figure out the possible minimal number of lines your friend drew on the paper. Input The first line of the input contains an integer T indicating the number of test cases( 0 < T <= 10). For each test case, the first line contains two integers n, m (1 ≤ n, m ≤ 50) representing the size of the grids on the paper. The following (n+1) × (m+1) numbers is what your friend writes. It is guaranteed that the number of lines your friend draws does not exceed 14. Each line passes through integer coordinates at least three times. Output For each test case, you need to output the minimal number of lines your friend drew on the paper in a single line. Sample Input 1 5 4 0 1 0 0 1 0 1 0 1 0 2 1 1 0 0 0 3 1 0 0 1 1 1 0 1 0 1 0 1 0 Sample Output 4
如何对一个矩阵进行分区？ _course
20161102Description Given an M * N matrix consisted of nonnegative elements, you may partition it into three parts with two straight line segments. The line segments cannot go through any element of the matrix and they must be parallel to the row or the column of the matrix, but they need not to be parallel to each other. Each of the three parts is a nonempty matrix, which means it contains at least one element. We define the value of a matrix as the sum of all elements in it. We denote the values of the three remaining matrices as X, Y, Z, and the balance degree as X  Y + Y  Z + Z  X, where . means the absolute value. Among all ways of partition, there is one, which has the least balance degree. Your task is to decide what the least balance degree is. Input The input will consist of several test cases. For each test case, two integers M and N are given in the first line, indicating the number of rows and columns of the matrix; each of the following M lines contains N integers, indicating the matrix. The input is terminated by a single line with two zeros. You may assume that 2 <= M, N <= 500 and all elements of the matrix are integers in the range [0, 65535]. There may be some blank lines between test cases. Output For each matrix of the input, print a line containing the least balance degree. Sample Input 3 3 9 8 7 6 5 4 3 2 1 0 0 Sample Output 10
Matrix _course
20171202Problem Description Give you a matrix(only contains 0 or 1),every time you can select a row or a column and delete all the '1' in this row or this column . Your task is to give out the minimum times of deleting all the '1' in the matrix. Input There are several test cases. The first line contains two integers n,m(1<=n,m<=100), n is the number of rows of the given matrix and m is the number of columns of the given matrix. The next n lines describe the matrix:each line contains m integer, which may be either ‘1’ or ‘0’. n=0 indicate the end of input. Output For each of the test cases, in the order given in the input, print one line containing the minimum times of deleting all the '1' in the matrix. Sample Input 3 3 0 0 0 1 0 1 0 1 0 0 Sample Output 2
Silver Matrix _course
20161224Description If a matrix satisfies the following conditions, we call it a silver matrix. 1. The dimensions of the matrix are n * n. 2. All its elements belong to the set S = {1, 2, 3, …, 2n  1}. 3. For every integer i (1 <= i <= n), all elements in the ith row and ith column make the set {1, 2, 3, …, 2n  1}. For example, the following 4 * 4 matrix is a silver matrix: It is proved that silver matrix with size 2K * 2K always exists. And it is your job to find a silver matrix with size 2K * 2K. Input The input contains only an integer K (1 <= K <= 9). Output You may output any matrix with size 2K * 2K. To output a 2K * 2K matrix, you should output 2K lines, and in each line output 2K integers. Sample Input 2 Sample Output 1 2 5 6 3 1 7 5 4 6 1 2 7 4 3 1
An easy Problem _course
20171024问题描述 : We define eA as following: Draw Where A is a n×n symmetric matrix with real elements, I is an identity matrix. Give you matrix A, your task is to calculate eA. 输入: There are several test cases; Each test case begin with a line contains an integer n (1≤n≤100), the following n lines contain n×n symmetric matrix A. The rang of elements of A is (100,100); n=0 is the end of input and need not to proceed. 输出: There are several test cases; Each test case begin with a line contains an integer n (1≤n≤100), the following n lines contain n×n symmetric matrix A. The rang of elements of A is (100,100); n=0 is the end of input and need not to proceed. 样例输入: 1 2 2 1 0 0 1 0 样例输出: 7.39 2.72 0.00 0.00 2.72
Graceful Matrix _course
20171208Problem Description In Matrix Science, Unit Matrix (UM) is a matrix in which the elements on diagonal are all 1, while others are all 0. Based on Unit Matrix, we define Basic Matrix and Graceful Matrix: 1.Basic Matrix (BM), BM_i means swap the ith rows and (i+1)th rows in the Unit Matrix. (0 based) 2.Graceful Matrix (GM), means in every rows and every columns, there is one and only one 1, while others are all 0. Now we also have a graceful problem, given a GM whose size is N, you need find a BM sequence. At first, the matrix is a UM, by multiplying the matrix one by one in the BM’s sequence order we can get the GM finally. You needn’t find the shortest sequence, but the sequence’s length can’t exceed the number of elements in GM. Input The first line contains a single integer T, indicating the number of test cases. Each test case begins with an integer N, indicating the GM’s size. Then N lines follow, each line contains N integers, 1 or 0, indicating the GM. You can assume the input Matrix is always graceful. Technical Specification 1. 1 <= T <= 50 2. 2 <= N <= 1000 Output For each test case, output the case number first, then the length of the sequence T your answer will give. Then follow T integers Ai, indicating BM_Ai, the sequence. If the length is zero, just output a blank line. Make sure your output BM_Ai never exceeds the Input N minus 1, because it doesn't make any sense. This is a Special Judge problem, so your format should not make any mistake. You can refer to the sample output for more information. Sample Input 3 2 1 0 0 1 2 0 1 1 0 4 0 1 0 0 1 0 0 0 0 0 0 1 0 0 1 0 Sample Output Case 1: 0 Case 2: 1 0 Case 3: 2 0 2
Test for Rikka _course
20170930Problem Description As we know, Rikka is poor at math. At the test, Rikka finds that she cannot even do a single problem. There is one of the insane problems: Given an integer K, she needs to come up with an n×n 01 matrix A and an integer m which meet B1,n=K, where B=Am. It is too difficult for Rikka. Can you help her? Input The first line of the input is a single integer T (T=40), indicating the number of testcases. Each of the next T lines contains one integer K (0≤K≤1018). Output For each testcase, the first line contains two spaceseparated integers n,m (1≤n,m≤30). In each of following n lines print n characters (0 or 1)  the matrix A you find. Sample Input 1 4 Sample Output 2 4 11 01
Linux 下编译c++ opengl的小程序_course
20150623完整的代码如下 ``` #include <GL/glut.h> #include <cmath> #include <utility> #include <vector> using std::vector; using std::pair; vector<pair<int, int> > my_points(4); vector<pair<int, int> > current_point(4); my_points.push_back(make_pair(0, 0)); my_points.push_back(make_pair(50, 0)); my_points.push_back(make_pair(100, 0)); my_points.push_back(make_pair(150, 0)); current_point = my_points; struct Degree { Degree(int a, int b, int c) { first = a; second = b; third = c; } int first; int second; int third; }; map<int, Degree> position(4); position[0] = position(0, 0, 0); position[1] = position(90, 0, 0); position[2] = position(45, 45, 45); position[3] = position(90, 0, 0); void init(); void display(); void draw_axis(); void reshape(int w, int h); void draw_frame(void); void translate(Degree& posi); void keyboard(unsigned char key, int x, int y); float matrix_rotat[3][3] = { // 旋转矩阵 {0.0, 1.0, 0.0}, {1.0, 0.0, 0.0}, {0.0, 0.0, 1.0} }; int main(int argc, char* argv[]) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLEGLUT_RGB); glutInitWindowSize(500, 500); glutInitWindowPosition(0, 0); glutCreateWindow(argv[0]); init(); glutDisplayFunc(display); glutReshapeFunc(reshape); glutKeyboardFunc(keyboard); glutMainLoop(); } void init(void) { glClearColor(0.1, 0.2, 0.4, 0.0); glShadeModel (GL_SMOOTH); } void reshape (int w, int h) { glViewport (0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode (GL_PROJECTION); glLoadIdentity (); if (w <= h) gluOrtho2D(200.0, 250.0, 100.0*(GLfloat)h/(GLfloat)w, 200.0*(GLfloat)h/(GLfloat)w); else gluOrtho2D(200.0*(GLfloat)w/(GLfloat)h, 250.0*(GLfloat)w/(GLfloat)h, 50.0, 200.0); glColor3f(1, 0.5, 0.4); glMatrixMode(GL_MODELVIEW); } void display() { glClear(GL_COLOR_BUFFER_BIT); glColor3f(1, 0.5, 0.4); draw_axis(); glLoadIdentity(); // draw_frame(); glFlush (); } void draw_frame() { glShadeModel(GL_SMOOTH); glBegin (GL_LINE_STRIP);//draw frame for (int i = 0; i < 4; i++) { glColor3f(1.0, 0.0, 0.0); glVertex2f(current_point[i].first, current_point[i].second); } glEnd(); } void draw_axis() { // draw coordinate axis glBegin(GL_LINES); glColor3f(1.0, 1.0, 1.0); // x axis glVertex2f(500.0, 40.0); glVertex2f(500.0, 40.0); glColor3f(1.0, 1.0, 1.0); // y axis glVertex2f(0.0, 400.0); glVertex2f(0.0, 400.0); glEnd(); // draw scale glBegin(GL_LINES); for (int i = 50; i <= 50; i++) { // x axis glColor3f(1.0, 1.0, 1.0); glVertex2f(10.0*i, 40.0); glVertex2f(10.0*i, 44.0); } for (int i = 40; i <= 40; i++) { // y axis glColor3f(1.0, 1.0, 1.0); glVertex2f(0.0, 10.0*i); glVertex2f(4.0, 10.0*i); } glEnd(); } void translate(Degree& posi) { ///// changed into matrix later vector<vector<double> > trans_matrix(2); for (int i = 0; i < 2; i++) for (int j = 0; j < 2; j++) trans_matrix[i].push_back(0); double num1[] = {cos(posi.first), sin(posi.first)}; //initialize the transform matrix for (int i = 0; i < 2; i++) trans_matrix[0][i] = num1[i]; double num2 = {sin(posi.first), cos(posi.first)}; for (int i = 0; i < 2; i++) trans_matrix[1][i] = num2[i]; current_point[0].first = current_point[0].second = 0; for (int i = 0; i < 2; i++) { current_point[0].first += (trans_matrix[i][0]*my_points[0].first + trans_matrix[i][1]*my_points[1].second); current_point[0].second += (trans_matrix[i][0]*my_points[0].first + trans_matrix[i][1]*my_points[0].second); } glBegin (GL_LINES);//draw frame glColor3f(1.0, 0.0, 0.0); glVertex2f(0, 0); glVertex2f(current_point[0].first, current_point[0].second); glEnd(); } /* void rotate_frame(void) { float (*tmp_frame)[7] = new float[3][7]; memset(tmp_frame, 0.0, sizeof(tmp_frame)); frame = tmp_frame; glLoadIdentity(); draw_frame(); // draw the frame after transformation glFlush(); } */ void keyboard(unsigned char key, int x, int y) { switch (key) { case 'Q': case 'q': translate(position[0]); break; case 'W': case 'w': translate(position[1]); break; case 'E': case 'e': translate(position[2]); break; case 'R': case 'r': translate(position[3]); break; } } ``` 编译器报错＞ arm.cpp:12:1: error: ‘my_points’ does not name a type my_points.push_back(make_pair(0, 0)); ^ arm.cpp:13:1: error: ‘my_points’ does not name a type my_points.push_back(make_pair(50, 0)); ^ arm.cpp:14:1: error: ‘my_points’ does not name a type my_points.push_back(make_pair(100, 0)); ^ arm.cpp:15:1: error: ‘my_points’ does not name a type my_points.push_back(make_pair(150, 0)); ^ arm.cpp:16:1: error: ‘current_point’ does not name a type current_point = my_points; ^ arm.cpp:28:1: error: ‘map’ does not name a type map<int, Degree> position(4); ^ arm.cpp:30:1: error: ‘position’ does not name a type position[0] = position(0, 0, 0); ^ arm.cpp:31:1: error: ‘position’ does not name a type position[1] = position(90, 0, 0); ^ arm.cpp:32:1: error: ‘position’ does not name a type position[2] = position(45, 45, 45); ^ arm.cpp:33:1: error: ‘position’ does not name a type position[3] = position(90, 0, 0); ^ 不知道这里是什么问题，STL为什么不能用，是编译选项的问题吗？ 编译命令g++ arm.cpp o arm lGL lglut lGLU
Caleidoscope _course
20170207Description We suppose even the very little children will play with KOKODáKH. So beside all the games and riddles, we need to have at least one toy in it. It is very favourite one and no special knowledge or ability is required to play with it. Yes, it is the Caleidoscope. I guess all of you know the magic thing. You can watch into it for long hours and still find new and new images that never repeat. But there is a problem with the little children. They break everything they have, all the things are falling from their hands down to the ground. The mechanics of caleidoscope is very fine and so it is very sensitive to proper handling. So our variant of this toy is not mechanical but fully electronic one. The main advantage is that it is waterresistant, fireresistant, coldresistant, it cannot break and does not catch fire. Besides, it contains a special teeth detector that prevents the children to bite it. Every tooth contact is detected and reacts with the electric shock (@@@) immediately. The main problem with our electric caleidoscope is the picture generating. To reach the quality of the mechanical caleidoscope, the picture must consist of many similar pieces that are resized, mirrored and rotated. As many of you probably know, we use matrices in computer graphics to manipulate pictures. The so called transformation matrix specifies the action that should be done with the picture. The picture manipulation is then done by matrix multiplication. We can also preform many transformations sequentially, by multiplying with more matrices. The picture manipulation is very difficult in the caleidoscope, so the matrices can be very large. Your task is to write a computer program that would be able to multiple the given matrix with the sequence of other matrices. When we multiple the matrix A (dimensions m * p) with the matrix B (dimensions p * n) we get the matrix C with the dimensions m * n. Every item with the indices i and j in the resulting matrix is the scalar product of the ith row of maxtrix A and jth column of matrix B: cij=Σ1<=k<=paik.bkj Input The input consists of Z assignments. The number of them is given by the single positive integer Z appearing on the first line of input. Each assignment begins with the line containing the single number X (1 <= X <= 10000) stating for the number of matrices. Then there are exactly X matrix descriptions. Each description begins with the line containing two integers M and N (1 <= M,N <= 100). M is the number of rows, N the number of columns. After these numbers there are exactly M lines each of them containing N integers seperated by space. These numbers are the matrix items. You can assume that the matrices really can be multipled. That means M of every matrix (except the first one) is the same as N of the previous one. The numbers are only as high that the items of resulting matrix should fit into integer. Also the items of every "partial result matrix" should fit there, when you will multiple them sequentially. Output The program should print out the resulting matrix for each assignment, with the dimensions m * n. The output should consist of m lines, each containing n numbers separated by exactly one space. Print one empty line after each assignment including the last one. Empty line contains one the special character newline. Sample Input 2 2 3 1 1 2 3 1 3 3 2 1 2 2 2 1 1 1 1 2 2 1 2 3 4 Sample Output 3 2 1 6 4 2 9 6 3 2 2 2 2
AgriNet _course
20171012Description Farmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the area. He needs your help, of course. Farmer John ordered a high speed connection for his farm and is going to share his connectivity with the other farmers. To minimize cost, he wants to lay the minimum amount of optical fiber to connect his farm to all the other farms. Given a list of how much fiber it takes to connect each pair of farms, you must find the minimum amount of fiber needed to connect them all together. Each farm must connect to some other farm such that a packet can flow from any one farm to any other farm. The distance between any two farms will not exceed 100,000. Input The input includes several cases. For each case, the first line contains the number of farms, N (3 <= N <= 100). The following lines contain the N x N conectivity matrix, where each element shows the distance from on farm to another. Logically, they are N lines of N spaceseparated integers. Physically, they are limited in length to 80 characters, so some lines continue onto others. Of course, the diagonal will be 0, since the distance from farm i to itself is not interesting for this problem. Output For each case, output a single integer length that is the sum of the minimum length of fiber required to connect the entire set of farms. Sample Input 4 0 4 9 21 4 0 8 17 9 8 0 16 21 17 16 0 Sample Output 28
 373KB
2020数学建模A题
202009112020数学建模国赛A题及其数据 2020数学建模国赛A题及其数据2020数学建模国赛A题及其数据 2020数学建模国赛A题及其数据 2020数学建模国赛A题及其数据 2020数学建模国赛A题及其数据
Java8零基础入门视频教程
20160929这门课程基于主流的java8平台，由浅入深的详细讲解了java SE的开发技术，可以使java方向的入门学员，快速扎实的掌握java开发技术！
MySQL数据库从入门到实战课
20191231限时福利1：购课进答疑群专享柳峰（刘运强）老师答疑服务。 为什么说每一个程序员都应该学习MySQL？ 根据《20192020年中国开发者调查报告》显示，超83%的开发者都在使用MySQL数据库。 使用量大同时，掌握MySQL早已是运维、DBA的必备技能，甚至部分IT开发岗位也要求对数据库使用和原理有深入的了解和掌握。 学习编程，你可能会犹豫选择 C++ 还是 Java；入门数据科学，你可能会纠结于选择 Python 还是 R；但无论如何， MySQL 都是 IT 从业人员不可或缺的技能！ 【课程设计】 在本课程中，刘运强老师会结合自己十多年来对MySQL的心得体会，通过课程给你分享一条高效的MySQL入门捷径，让学员少走弯路，彻底搞懂MySQL。 本课程包含3大模块： 一、基础篇： 主要以最新的MySQL8.0安装为例帮助学员解决安装与配置MySQL的问题，并对MySQL8.0的新特性做一定介绍，为后续的课程展开做好环境部署。 二、SQL语言篇： 本篇主要讲解SQL语言的四大部分数据查询语言DQL，数据操纵语言DML，数据定义语言DDL，数据控制语言DCL，学会熟练对库表进行增删改查等必备技能。 三、MySQL进阶篇： 本篇可以帮助学员更加高效的管理线上的MySQL数据库；具备MySQL的日常运维能力，语句调优、备份恢复等思路。
 1.16MB
微信小程序 实例汇总 完整项目源代码
20161101微信小程序 实例汇总 完整项目源代码
《C语言/C++学习指南》语法篇（从入门到精通）
20150603一门初级、从入门到精通的C语言C++语法教程，由毕业于清华大学的业内人士执课。从简单的HelloWorld入门程序，到深入的C语言C++核心概念，均为您娓娓道来，言之必详、听之必懂。让C语言C++编程变得简单，让C语言C++编程变得有趣，让喜欢C语言C++的人学会C语言C++！
 博客 第五
 学院 PHP微信小程序母婴用品商城 大学生毕业设计 教学视频
 博客 全平台小程序开发框架Uniapp重点概览
 博客 Flask01：环境基础
 博客 商城小程序制作教程及制作价格费用标准
 学院 2020年_Python_Flask基础+实战全套视频【千锋】
 下载 基于Android平台的即时通信系统客户端设计
 下载 基于MB86R01的ARM嵌入式汽车数字化虚拟仪表
 下载 电源技术中的集成电源噪声抑制的时钟源简化FPGA系统的电源设计
 下载 广州博玮BWS伺服驱动在大重型机床上的应
 学院 JavaWeb家具家居购物商城毕业设计 大学生毕业设计教学视频
 博客 画一个 自定义控件 房子动态吹风
 学院 深度学习原理与实战（上部）
 下载 电子测量中的基于GSM技术的冻土区土壤温度监测系统
 博客 计组之总线：2、总线仲裁(链式查询、计数器查询、独立请求、分布式查询)
 下载 PHP缩略图生成和图片水印制作
 学院 Unity热更新框架基于ILRuntime
 下载 JavaScript自定义浏览器滚动条兼容IE、 火狐和chrome
 博客 权威指南：Serverless 未来十年发展解读 — 伯克利分校实验室分享（下）
 博客 Python爬取B站TES VS FNC 八强赛弹幕，牛逼克拉斯
 学院 PHP微信小程序手机数码商城 大学生毕业设计 教学视频
 下载 利用jquery实现实时更新歌词的方法
 下载 JavaScript中Math对象的方法介绍
 学院 基于海思3536平台为示例的嵌入式软件开发基础篇
 下载 基于wepy框架实现的商城小程序
 博客 myeclipse怎么点击编辑区定位到项目所在的目录
 下载 yolov3_demo.zip
 下载 openssh8.4p1.tar.gz
 下载 Amazon EC2 服务简介.pdf
 下载 多串口通讯协议转换案例