洛谷
轻舟001
这个作者很懒,什么都没留下…
展开
-
P2550 [AHOI2001]彩票摇奖
https://www.luogu.com.cn/problem/P2550// 输出的中奖结果使用数组记录,位置1~7初始为0,每中一张彩票,对应位置+1// 使用一个数组记录中奖号码,每张彩票和此数组对比,对比结果初始为0,每比中一个数字,结果+1,7次的累计结果投入中奖结果数组#include <iostream>using namespace std;in...原创 2020-03-23 09:32:13 · 762 阅读 · 0 评论 -
P2615 神奇的幻方
https://www.luogu.com.cn/problem/P2615#include <iostream>using namespace std;int ouput[39*39] = {0};int main(){ int n(0); cin >> n; int total = n * n; int index = ...原创 2020-03-23 09:31:05 · 172 阅读 · 0 评论 -
P5730 【深基5.例10】显示屏
https://www.luogu.com.cn/problem/P5730// 首先将0~9的输出固化到预置数组// 根据输出数量,逐行输出,每行取每个数字的3个元素,共取5行#include <iostream>using namespace std;char num[10][15] = {'X','X','X','X','.','X','X','.','X','...原创 2020-03-23 09:29:44 · 1043 阅读 · 0 评论 -
P1308 统计单词数
https://www.luogu.com.cn/problem/P1308#include <cstdio>#include <cstring>#include <iostream>#include <string>#include <vector>using namespace std;static vect...原创 2020-03-23 09:24:37 · 119 阅读 · 0 评论 -
P1089 津津的储蓄计划
https://www.luogu.com.cn/problem/P1089// 逐月计算,需要记录当前余额、存储总额,如果当前余额+300<本月预算,则出现异常。// 年终:存储总额*1.2+当前余额#include <iostream>using namespace std;int main(){ int _remaining = 0; ...原创 2020-03-18 09:21:52 · 398 阅读 · 0 评论 -
P2181 对角线
https://www.luogu.com.cn/problem/P2181注意事项:高精,会超出int、long long的范围,需要使用 unsigned long long思路:n边形,先看每个点能够发出多少条对角线:n-3 (不能和自己、边上两个点连接)再看每条对角线有多少个交点,从第一条线开始,第一条线:左边1个点,右边n-2-1个点,交点数 1 * n-2-1第二条线:左边...原创 2020-03-17 21:17:52 · 453 阅读 · 0 评论 -
P5710 【深基3.例2】数的性质
https://www.luogu.com.cn/problem/P5710#include <iostream>using namespace std;int main(){ int n(0),a(0),b(0),c(0),d(0),b1(0),b2(0); cin >> n; if (n%2 == 0) b1 = 1...原创 2020-03-17 21:16:30 · 395 阅读 · 0 评论 -
P5717 【深基3.习8】三角形分类
https://www.luogu.com.cn/problem/P5717#include <iostream>using namespace std;int main(){ int a(0),b(0),c(0); cin >> a >> b >> c; if (a > c) { ...原创 2020-03-17 21:15:47 · 1009 阅读 · 0 评论 -
P4414 [COCI2006-2007#2] ABC
https://www.luogu.com.cn/problem/P4414#include <iostream>using namespace std;int main(){ int a(0),b(0),c(0); char a1,b1,c1; cin >> a >> b >> c; cin >&...原创 2020-03-17 21:14:30 · 643 阅读 · 0 评论 -
P1055 ISBN号码
https://www.luogu.com.cn/problem/P1055#include <iostream>using namespace std;int main(){ char _input[11] = {0}; cin >> _input[1] >> _input[0]; cin >> _input[...原创 2020-03-17 21:13:34 · 88 阅读 · 0 评论 -
P1008 三连击
https://www.luogu.com.cn/problem/P1008#include <iostream>using namespace std;int numList[10];void resetList(){ for(int i = 0; i < 10; i++) { numList[i] = 1; }}...原创 2020-02-05 11:05:48 · 120 阅读 · 0 评论 -
P1085 不高兴的津津
https://www.luogu.com.cn/problem/P1085#include <iostream>using namespace std;int main(){ int sum = 0; int n = 7; int iRet = -1; int a,b; for(int i = 0; i < n; i++...原创 2020-02-05 10:29:40 · 179 阅读 · 0 评论 -
P1781 宇宙总统
https://www.luogu.org/problem/P1781待处理内容:1.数据录入需要使用string2.排序(比较)需要根据string重写#include <iostream>#include <algorithm>#include <string>using namespace std;bool sortFun(co...原创 2019-11-17 17:15:47 · 126 阅读 · 1 评论 -
P1059 明明的随机数
https://www.luogu.org/problem/P1059两种方式:可以直接使用stl的map;也可以使用数组#include <iostream>#include <cstring>using namespace std;int inputList[1001];int main(){ int n; memset(i...原创 2019-11-17 16:43:03 · 64 阅读 · 0 评论 -
P1068 分数线划定
https://www.luogu.org/problem/P1068待处理内容:1.分数排序(从高到低),序号排序(从小到大)2.到分数线时,分数相等的继续输出#include <iostream>#include <vector>#include <algorithm>using namespace std;struct Item{...原创 2019-11-17 15:41:15 · 174 阅读 · 0 评论 -
P1098 字符串的展开
https://www.luogu.org/problem/P1098待处理内容:1.参数优先级:p3>p2>p12.-前后字符判断:相邻则删除符号;同为数字或者字母且后>前,则按参数处理;相等或其他情况则保持不变#include <iostream>#include <cstdio>#include <cstring>...原创 2019-11-09 22:53:58 · 93 阅读 · 0 评论 -
P1067 多项式输出
https://www.luogu.org/problem/P1067待处理内容:1.数字:为1不输出数字,为0不输出此项2.符号:第一个仅输出-,后续>=0输出+,<0输出-#include <iostream>using namespace std;int inputN[101];int num[101];char flag[101];i...原创 2019-11-09 21:55:01 · 73 阅读 · 0 评论 -
P1177 【模板】快速排序
https://www.luogu.org/problem/P1177#include <iostream>#include <fstream>using namespace std;int n;int inputList[100000];bool test = false;void swap(int i, int j){ if(tes...原创 2019-11-06 09:25:31 · 140 阅读 · 0 评论 -
P1031 均分纸牌
https://www.luogu.org/problem/P1031#include <iostream>using namespace std;int n;int inputList[100];int main(){ int sum = 0; cin >> n; for(int i = 0; i < n; i++)...原创 2019-11-05 09:17:36 · 66 阅读 · 0 评论 -
P1540 机器翻译
https://www.luogu.org/problem/P1540#include <iostream>#include <set>#include <string.h>using namespace std;int inputM[1001];int inputN[1001];set<int> mList;int m...原创 2019-11-04 09:32:32 · 100 阅读 · 0 评论 -
P1003 铺地毯
https://www.luogu.org/problem/P1003#include <iostream>#include <vector>using namespace std;struct SRectangle{ int a; int b; int x; int y;};int main(){ in...原创 2019-11-04 08:49:29 · 86 阅读 · 0 评论 -
P1911 L国的战斗之排兵布阵
https://www.luogu.org/problem/P1911#include <iostream>#include <set>#include <vector>#include <algorithm>using namespace std;struct SPoint{ int x; int y; ...原创 2019-11-03 14:21:25 · 408 阅读 · 0 评论 -
P1426 小鱼会有危险吗
https://www.luogu.org/problem/P1426#include <iostream>using namespace std;int main(void){ double s,x; cin>>s>>x; char cRet = 'n'; double sBegin = s-x; d...原创 2019-11-02 11:15:07 · 60 阅读 · 0 评论 -
P1478 陶陶摘苹果(升级版)
https://www.luogu.org/problem/P1478#include <iostream>#include <vector>#include<algorithm>using namespace std;struct Item{ int xi; int yi;};vector<Item> ...原创 2019-11-01 21:17:30 · 102 阅读 · 0 评论 -
P1028 数的计算
https://www.luogu.org/problem/P1028#include <iostream>using namespace std;int dst[1001] = {0};int main(void){ int n; cin>>n; dst[0] = 1; dst[1] = 1; for(int ...原创 2019-11-01 20:48:29 · 87 阅读 · 0 评论 -
P1149 火柴棒等式
https://www.luogu.org/problem/P1149#include <iostream>#include <string>#include <string.h>#include <stdio.h>using namespace std;char array[10]={6,2,5,5,4,5,6,3,7,6};...原创 2019-11-01 20:15:23 · 190 阅读 · 0 评论 -
P1914 小书童——密码
https://www.luogu.org/problem/P1914//也可以设置一个a-za-z的数组,for循环里面就不用判断是否>25了#include <iostream>#include <string>using namespace std;int main(void){ int n; string str; c...原创 2019-11-01 19:09:05 · 90 阅读 · 0 评论 -
P1567 统计天数
https://www.luogu.org/problem/P1567#include <iostream>using namespace std;int array[1000000] = {0};int main(void){ int n; cin>>n; for(int i = 0; i < n; i++) {...原创 2019-11-01 18:55:22 · 126 阅读 · 0 评论 -
P1980 计数问题
https://www.luogu.org/problem/P1980#include <iostream>#include <string.h>#include <stdio.h>using namespace std;char str[8]={0};int countX(int n, int x){ memset(str, 0...原创 2019-11-01 18:43:54 · 65 阅读 · 0 评论 -
P1909 买铅笔
https://www.luogu.org/problem/P1909#include <iostream>using namespace std;int main(){ int n,num1,price1,num2,price2,num3,price3; cin>>n>>num1>>price1>>num...原创 2019-11-01 18:13:09 · 102 阅读 · 0 评论 -
P1422 小玉家的电费
https://www.luogu.org/problem/P1422#include<iostream>#include<cstdio>using namespace std;int main(void){ int a; cin>>a; if(a<=150) printf("%.1f\n", a*...原创 2019-11-01 18:02:40 · 119 阅读 · 0 评论