- 博客(36)
- 收藏
- 关注
原创 mysql的配置
1、下载mysql5.7 2、配置环境 在系统环境中 添加 MYSQL_HOME 值:C:\Program Files\MySQL \MySQL Server 5.7(mysql安装默认地址) 之后在path中添加%MYSQL_HOME%\bin 3、首先移除现在的MYSQL服务 进入mysql安装的bin目录 打开DOS命令行输入: mysqld --remove mysql 4、查看MYSQL根目录是否有data文件夹 若有,删除并新建一个空的data文件夹 若没有,新建一个空的dat
2021-11-16 14:56:49
487
1
原创 Database UVA - 1592
stringstream 可以有效地截取字符子串,空格、回车、换行都是默认的分界符,也可以类型转换。 getline(istream,string,char) 相当与是一个scanf,默认是回车结束,结束条件可以自定义。 下面是我看过的几个博客。 stringstream字符串分割与类型转换 用stringstream可以用指定字符分割字符串 C++ int与string的相互转换(含源码实现) 因为我用的是c++5.11,所以自己写了个to1_string( )。 /*database*/ #includ
2020-10-27 19:04:56
144
原创 Cable master-POJ1064
#include<cstdio> #include<cmath> #define INF 100000000 using namespace std; int n,k; double l[10010]; bool C(double x) { int sum=0; for(int i=1;i<=n;i++) { sum+=(int)(l[i]/x); } return sum>=k; } void solve() { double dl=0,du=INF
2020-10-16 19:53:45
259
原创 基数排序
#include<iostream> #include<cstring> #include<cstdio> using namespace std; int getmaindigit(int* arr,int n) { int base=10; int digit=1; for(int i=0;i<n;i++) { while(arr[i]>=base){ digit++; base*=10; } } return digi
2020-10-14 17:35:16
90
原创 Oil Deposits UVA - 572
Oil Deposits UVA - 572 #include<iostream> #include<cstdio> #include<cstring> #include<map> #include<vector> #define IOS std::ios:sync_with_stdio(false);cin.tie(false);cout.tie(false); using namespace std; string mer[115]; int
2020-10-10 16:08:44
136
1
原创 数论入门笔记
数论入门 目录数论入门一、 数论是什么二、二、使用步骤1.引入库2.读入数据总结 一、 数论是什么 数论主要研究整数的性质。例如一些特殊的数,如质数,素数,公因数,公倍数。 二、 示例:pandas 是基于NumPy 的一种工具,该工具是为了解决数据分析任务而创建的。 二、使用步骤 1.引入库 代码如下(示例): import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns im
2020-09-23 17:31:16
998
1
原创 ccpc
1003 #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using namespace std; const int l9 = 1000000+10; long long int map[l9]; int main() { int t; scanf("%d",&t); for(int i=0;i<t;i++) { long long int
2020-09-20 17:43:07
277
原创 Unix ls UVA - 400
Unix ls UVA - 400 #include<iostream> #include<string> #include<algorithm> using namespace std; const int Maxcol=60; const int Maxn=100+5; string filenames[Maxn]; void print(const string& s,int len,char extra) { cout<<s; for
2020-09-20 11:33:29
98
原创 BigInteger
以后会完善的 #include<iostream> #include<algorithm> #include<cstdio> #include<cstring> #include<ctime> #include <iomanip> #include<vector> using namespace std; struct BigInteger{ static const int BASE=100000000; stati
2020-09-18 19:07:25
121
原创 Ugly Numbers UVA - 136
Ugly Numbers UVA - 136 #include<iostream> #include<set> #include<vector> #include<queue> using namespace std; typedef long long int ll; const ll cur[3]={2,3,5}; int main() { priority_queue<ll,vector<ll>,greater<ll> &
2020-09-17 09:25:15
89
原创 Team Queue UVA - 540
Team Queue UVA - 540 #include<iostream> #include<algorithm> #include<queue> #include<map> using namespace std; const int maxt=1000+10; int main() { int t,kase=1; while(cin>>t&&t) { cout<<"Scenario #"<<
2020-09-16 17:22:23
157
1
原创 The SetStack Computer UVA - 12096
The SetStack Computer UVA - 12096 #include<cstdio> #include<iostream> #include<iterator> #include<algorithm> #include<vector> #include<map> #include<set> #include<stack> #define ALL(x) x.begin(),x.end() #defi
2020-09-15 14:48:50
106
原创 Ananagrams UVA - 156
Ananagrams UVA - 156. #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #include<map> #include<vector> using namespace std; map <string,int> con; vector<string> ans; string rep(string
2020-09-10 16:11:24
98
原创 Andy‘s First Dictionary UVA - 10815
#include<cstdio> #include<cstring> #include<iostream> #include<sstream> #include<algorithm> #include<set> using namespace std; set<string> word; int main() { string a,b; while(cin>>a) { for(int i=0;i&l
2020-09-09 12:51:41
93
原创 The Blocks Problem UVA - 101
The Blocks Problem UVA - 101. #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #include<vector> using namespace std; vector<int> pile[35]; void find_pile(int a,int& px,int& py,int n) { f
2020-09-09 08:58:14
113
原创 Repeating Decimals UVA - 202
#include<cstdio> #include<cstring> char a[6000]; int b[6000]; int main() { int n,m; while(scanf("%d%d",&n,&m)!=EOF) { int f=0; int count1=0,cur=0; int s=n/m; int u=(n%m)*10; int i=0; a[i++]='.'; while(i<6000) {
2020-09-08 12:47:57
82
原创 Crossword Answers UVA - 232
#include<cstdio> #include<cstring> using namespace std; char a[100][100]; int b[100][100]; int main() { int n,m,t=0; while(1) { memset(b,0,sizeof(b)); scanf("%d",&n); if(n==0)break; scanf("%d",&m); for(int i=0;i<n;i++
2020-09-08 12:46:56
76
原创 All in All UVA - 10340
#include<cstdio> #include<cstring> char a[1000000],b[1000000]; int main() { while(scanf("%s %s",a,b)!=EOF) { getchar(); int f=0;int k=0; for(int i=0;a[i]!='\0';i++) { if(b[k]=='\0'){f=1;break; } for(;b[k]!='\0';k++) {
2020-09-08 12:45:46
114
原创 IP Networks UVA - 1590
#include<cstdio> using namespace std; struct ip{ int a[5]; ip(int a1=0,int a2=0,int a3=0,int a4=0){a[1]=a1;a[2]=a2;a[3]=a3;a[4]=a4;} void operator = (const ip a) { for(int i=1;i<=4;i++) { this->a[i]=a.a[i]; } } }; ip min(ip a,ip
2020-09-08 12:43:27
153
原创 A Typical Homework (a.k.a Shi Xiong Bang Bang Mang) UVA - 12412
#include<bits/stdc++.h> using namespace std; #define maxn 1000 #define maxl 100 #define EPS 1e-6 int n = 0; char sid[maxn][maxl]; int cid[maxn]; char name[maxn][maxl]; int score[maxn][5]; int removed[maxn]; const char* course_name[] = {"Chinese","M
2020-09-04 22:25:23
122
原创 Spreadsheet Tracking UVA - 512
#include<cstdio> #include<algorithm> using namespace std; struct node{ int x, y; node(int x=0,int y=0):x(x),y(y){}; node operator = (node& b){ int t=this->x; this->x=b.x; b.x=t; t=this->y; this->y=b.y; b.y=t; }
2020-09-03 22:36:51
108
原创 Where is the Marble? UVA - 10474
#include<cstdio> #include<algorithm> using namespace std; int map[1000000]; int main() { int n,x,sum=0; while(scanf("%d%d",&n,&x)==2&&n) { for(int i=1;i<=n;i++) { scanf("%d",&map[i]); } sort(map+1,map+n+1);
2020-09-02 21:15:40
176
原创 Message Decoding UVA - 213
#include<cstdio> #include<cstring> using namespace std; char code[8][1<<8]; char inputchar() { char ch; while(1) { ch=getchar(); if(ch!='\n'&&ch!='\r')return ch; } } int intchar(int c) { int s=0; for(int i=0;i<c;i++)
2020-08-28 22:37:12
116
原创 The Dole Queue UVA - 133
#include<cstdio> #include<cstring> using namespace std; int n; int k,m; int a[30]; int fun(int x,int v) { int k=v<0?-1:1; int u=0; while(1) { if(a[x]==0){u+=k; } if(u==v){break; } x=(x+n+k)%n; if(x==0)x=n; } return x;
2020-06-27 11:20:17
89
原创 Ancient Cipher UVA - 1339
#include<cstdio> #include<cstring> #include<algorithm> using namespace std; int a[36]; int b[36]; char c[136]; char d[136]; bool map(int x,int y){return x>y; } int main() { while(1) { if(scanf("%s %s",c,d)!=2)return 0; getcha
2020-06-26 16:51:40
108
原创 Hangman Judge UVA - 489
#include<cstdio> #include<cstring> char word[200],guess[200]; int main() { int n; while(scanf("%d",&n)!=EOF&&n!=-1) { getchar(); scanf("%s%s",word,guess); int l=0,r=0,s=0; while(guess[l]!='\0') { r=0; int f
2020-06-26 16:49:25
140
原创 Kickdown UVA - 1588
思路:可以把最长的看做是一个原地不动装置,另外一个装置从左向右移动。 #include<cstdio> #include<cstring> using namespace std; char a[200],b[200]; int lenght(char* x) { int i; for(i=0;x[i]!='\0';i++); return i; } int main() { while(scanf("%s%s",a,b)!=EOF) { getchar(); in
2020-06-15 08:54:48
150
原创 Box UVA - 1587
思路:一个长方形六个面之间两两相等,所以在确认了六个面两两相等之后,只需要通过3个面就可以确定是否能形成一个长方形,通过按升序排好的长方体进行优化就可以找到规律来。 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; typedef struct node{ int h,w; }nod; nod node[7]; bool map(nod x,nod y) { if(x
2020-06-12 23:52:02
102
原创 Constructing the Array-Codeforces 1353D
用优先队列来把个数最多的、个数相同区间靠左的放在队列的前端 #include<cstdio> #include<cstring> #include<algorithm> #include<queue> //#include<vector> using namespace std; struct node { int x,y; int len=0; }; struct map { bool operator ()(const node&am.
2020-05-16 14:39:15
202
原创 UVa 1144 Even Parity(暴力枚举)
题目大意:给出一个由0和1组成的矩阵,修改最少的0变成1,使得矩阵中每个位置的上下左右存在的情况下,和为偶数,无解输出-1。 题解:枚举出第一行,就可以将剩下的确定下来。 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int n; int A[20][20]...
2020-03-30 21:58:04
100
原创 uva 10881 Piotr's Ants(模拟)
题意:一根Lcm木棒上有n只蚂蚁,速度为1cm/s,每只蚂蚁要么向左,要么向右,,当两只蚂蚁相撞时,都掉头。给出蚂蚁的初始位置和朝向,求t秒时每只蚂蚁的状态。 题解:整体上看每只蚂蚁碰撞后掉头等价于穿过去,例如A蚂蚁在2cm位置向右运动,B蚂蚁在3cm位置向左运动,如果直接穿过去,2秒后A蚂蚁在4cm位置向右运动,B蚂蚁在1cm位置向左运动,如果掉头,2秒后A蚂蚁在1cm位置向左运动,B蚂蚁在4c...
2020-03-26 14:19:29
102
原创 poj 3154 Graveyard(思路题)
题意:周长10000的圆上有n个等距的墓碑,现在有m个墓碑加入,移动之前的墓碑,使加入之后每个墓碑依然是等距的,求原来移动的最小距离。 题解:找每个旧墓碑位置相邻新加入墓碑后的位置,之间最短距离累加,重合的跳过。 注意:计算时的精度,double 有效数字是15~16位,long double 有效数字是18~19位 #include<cstdio> #include<algor...
2020-03-25 22:26:12
153
原创 uav 11300 Spreading the Wealth (递推,贪心)
题意:圆桌旁有n个人,每个人有一定数量的金币,现在求总共要移动至少多少金币,才能使每个人的金币数量都一样。 题解:假设第i个人在整个移动过程中,第(i - 1)个人给了第i个人x金币,第i个人又给了第(i - 1)个人y金币,与第(i - 1)个人给了第i个人(x - y)个金币效果是一样的,如果直接给(x-y)个金币,移动金币的数量也是最少的。所以可以认为整个移动是按这同一方向进行的,第(i -...
2020-03-25 18:01:42
110
原创 初学vector
#include<iostream> #include<algorithm> #include<vector> using namespace std; int y[10]={1,2,3,4,5}; int main() { vector<double> a; a.push_back(100.8);//插入最后 a.push_back(2...
2020-03-23 19:56:36
100
原创 uva 11729 Commando war (贪心)
题意: 有n个部下,每个部下要完成一项任务,第i个士兵要花b[i]时间给他布置任务,并且他要花 j[i]时间去完成任务.你一次只能给一个士兵布置任务.布置任务的时候,其他士兵可以独立执行任务,求所有任务完成的最短时间; 分析: 有两种情况: 一是上一个任务的(执行时间)>下一个任务的(布置时间+执行时间),此时完成最短时间为上一个任务的(布置时间+执行时间),前面的执行时间越长,完成时间越...
2020-03-23 00:06:49
171
原创 uva 11292 Dragon of Loowater (简单贪心)
题意: 有m个骑士,n头的龙,一个能力值为x的骑士可以砍掉恶龙一个直径不超过x的头,且需要支付x的金币,一个人只能砍一个头,求砍掉龙的所有头支付最少的金币。无解输出 “Loowater is doomed!”。 解法: 先把龙头的直径和勇士的能力按从小到大排序,之后按顺序将龙头的直径和骑士的能力比较,能力大于半径,支付金币,当龙头被砍完了就结束比较,输出结果. #include<cstdio...
2020-03-22 20:27:19
174
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅