自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(8)
  • 资源 (1)
  • 收藏
  • 关注

原创 最短路径问题

最短路径算法

2022-07-28 21:37:23 134

原创 最小生成树

基于邻接矩阵的最小生成树算法

2022-07-26 21:22:38 213 1

原创 BFS and DFS

基于邻接矩阵的广度优先遍历(BFS)和深度优先遍历(DFS)

2022-07-26 20:54:41 127

原创 L1-054 福到了 (15 分)

L1-054 福到了 (15 分)“福”字倒着贴,寓意“福到”。不论到底算不算民俗,本题且请你编写程序,把各种汉字倒过来输出。这里要处理的每个汉字是由一个 N × N 的网格组成的,网格中的元素或者为字符 @ 或者为空格。而倒过来的汉字所用的字符由裁判指定。输入格式:输入在第一行中给出倒过来的汉字所用的字符、以及网格的规模 N (不超过100的正整数),其间以 1 个空格分隔;随后 N 行,每行给出 N 个字符,或者为 @ 或者为空格。输出格式:输出倒置的网格,如样例所示。但是,如果这个字正过来倒

2021-04-23 23:23:05 192

原创 L1-046 整除光棍 (20 分)

L1-046 整除光棍 (20 分)这里所谓的“光棍”,并不是指单身汪啦~ 说的是全部由1组成的数字,比如1、11、111、1111等。传说任何一个光棍都能被一个不以5结尾的奇数整除。比如,111111就可以被13整除。 现在,你的程序要读入一个整数x,这个整数一定是奇数并且不以5结尾。然后,经过计算,输出两个数字:第一个数字s,表示x乘以s是一个光棍,第二个数字n是这个光棍的位数。这样的解当然不是唯一的,题目要求你输出最小的解。提示:一个显然的办法是逐渐增加光棍的位数,直到可以整除x为止。但难点在于,

2021-04-18 11:49:05 103

原创 Python中的排序函数

Python中的排序函数列表排序sort函数sort函数:list.sort(cmp=None,key=None,reverse=False)对原列表进行排序,完成排序后,原列表变为有序列表。sorted函数sorted函数:sorted(iterable, cmp=None, key=None, reverse=False)cmp: 可以自定义比较参数。对原列表进行排序,完成排序后,产生一个新的有序列表。字典排序sorted函数:sorted(iterable,key,re

2021-04-10 11:38:42 6856

原创 C#----飞行棋

C#----飞行棋话不多说,直接上代码。下面展示 完整代码。// A code blocknamespace 飞行棋{ class Program { public static int[] Maps = new int[100]; public static int[] PlayerPos = new int[2]; public static string[] PlayerName = new string[2];

2021-01-30 23:00:50 659 3

原创 使用C#编辑的简易电子商城小项目

使用C#编辑的简易电子商城小项目类在个人设计的项目中总共四款电子商品,他们有共同的父类;五种可供选择的打折方式(书写了两种类),他们亦有共同的父类;除此之外还有一个仓库类,和收银类;与主函数所在类共计11个类。下面展示 全部代码。// A code blockusing System;using System.Collections.Generic;namespace Elect{ class Program { static void Main(stri

2021-01-30 22:55:14 764

ADGAN.pdf

ADGAN.pdf

2023-11-07

复数运算符.vcxproj

#include<iostream> #include<cmath> using namespace std; class Complex { public: Complex(double r = 0.0, double m = 0.0) :real(r), magic(m) { cout << "Complex instructor!" << endl; } ~Complex() { cout << "Complex destructor!" << endl; } void display() const { if (real == 0) cout << magic << "i" << endl; else { if (magic > 0) cout << real << "+" << magic << "i" << endl; else if (magic < 0) cout << real << magic << "i" << endl; else cout << real << endl; } } Complex operator +(const Complex& c2) const; Complex operator -(const Complex& c2) const; Complex operator *(const Complex& c2) const; Complex operator /(const Complex& c2) const; friend Complex operator + (const double& d, const Complex& c); friend Complex operator - (const double& d, const Complex& c); friend Complex operator + (const Complex& c, const double& d); friend Complex operator - (const Complex& c, const double& d); friend ostream& operator << (ostream& out, const Complex& c);//operator"<<" friend Complex operator / (const double& d, const Complex& c); friend Complex operator * (const Complex& c, const double& d); friend Complex operator / (const Complex& c, const double& d); private: double real, magic; }; Complex Complex::operator +(const Complex& c2) const { return Complex(real + c2.real, magic + c2.magic);//copy } Complex Complex::operator -(const Complex& c2) const { return Complex(real - c2.real, magic - c2.magic);//copy } Complex Complex::operator *(const Complex& c2) const { return Complex(real * c2.real - magic * c2.magic, c2.real * magic + real*c2.magic);//copy } Complex Complex::operator /(const Complex& c2) const { double k = pow(c2.real, 2) + pow(c2.magic, 2); return Complex((real * c2.real + magic * c2.magic)/k, (c2.real * magic - real * c2.magic)/k);//copy } Complex operator + (const double& d, const Complex& c) { return Complex(d + c.real, c.magic);//copy } Complex operator - (const double& d, const Complex& c) { return Complex(d - c.real, -c.magic);//copy } Complex operator + (const Complex& c, const double& d) { return Complex(c.real + d, c.magic);//copy } Complex operator / (const double& d, const Complex& c) { double k = pow(c.real, 2) + pow(c.magic, 2); return Complex(d * c.real / k, - d * c.magic / k);//copy } Complex operator - (const Complex& c, const double& d) { return Complex(c.real - d, c.magic);//copy } Complex operator * (const Complex& c, const double& d) { return Complex(c.real * d, c.magic * d);//copy } Complex operator / (const Complex& c, const double& d) { return Complex(c.real / d, c.magic / d);//copy } ostream& operator<<(ostream& out, const Complex& c) { if (c.real == 0) cout << c.magic << "i" << endl; else { if (c.magic > 0) cout << c.real << "+" << c.magic << "i" << endl; else if (c.magic < 0) cout << c.real << c.magic << "i" << endl; else cout << c.real << endl; } return out; } int main() { Complex C1(5, 4), C2(7,2), C3; cout << "C1=" << C1 << endl; cout << "C2=" << C2 << endl; C3 = C1 + C2; cout << "C3=" << C3 << endl; C3 = C1 - C2; cout << "C3=" << C3 << endl; C3 = C1 * C2; cout << "C3=" << C3 << endl; C3 = C1 / C2; cout << "C3=" << C3 << endl; double d; cin >> d; C3 = d + C1; cout << "C3=" << C3 << endl; C3 = d - C1; cout << "C3=" << C3 << endl; C3 = C1 + d; cout << "C3=" << C3 << endl; C3 = C1 - d; cout << "C3=" << C3 << endl; C3 = C1 * d; cout << "C3=" << C3 << endl; C3 = C1 / d; cout << "C3=" << C3 << endl; C3 = d / C1; cout << "C3=" << C3 << endl; return 0; }

2020-06-06

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除