- 博客(8)
- 收藏
- 关注
原创 计算几何基础之“玻璃球”
思路1:暴力判断(数据比较弱) 思路2:叉积#include<bits/stdc++.h>using namespace std;struct node{ int x,y;};struct Line{ node a,b;}line[5005];int n,m,ans[5005];int cross(node p1,node p2,node p3){ return
2017-10-30 16:49:26
510
原创 2017ICPC乌鲁木齐网络赛E Half-consecutive Numbers
题目 题意: 给定一个 N,找到一个最小且不小于 N 的数 r,满足 tr 是平方数,输出 r 的值,若不存在则输出-1。思路: 1e16 的数据显然不能常规打表。 设: P=tr,P是平方数,则有正整数 k,满足k×k=P,而 P=i×(i+1)/2 设: a1×a2=i;b1×b2=(i+1)/2; 则必有 a1×b1==a2×b2==k,即 i 和 (i+1)/2 都是平方
2017-09-09 19:24:49
440
原创 基础算法之“最近点对”
这么魔性的代码不确定是不是自己写的…..#include<iostream>#include<algorithm>#include<cstdio>#include<cmath>using namespace std;int a[100005];struct point{ double x,y;}p[100005];inline double len(point &a , poi
2017-08-20 16:02:25
339
原创 基础算法之“蒜头君采摘苹果”
这是一道很简单的贪心,因为刚刚买这门课的时候水平很渣,只会暴力做法,就像下面的…. 可以用set或优先队列优化。#include<iostream>using namespace std;#define INF 2147483648void insert_sort(long long a[],int n){ int i,j; long long t; for(i=1
2017-08-19 16:58:22
543
原创 基础算法之“蒜头君买书”
输入价格,将价格从大到小排序,然后将3及3的倍数个价格重置为0 (注意价格数组的下标从0开始)#include<iostream>#include<algorithm>using namespace std;bool cmp(int a,int b){ return a>b;}int main(){ int sum=0,i,n; cin>>n; int
2017-08-19 16:16:25
480
原创 引言之“财务管理”
#include using namespace std;double res;int main(){ res = 0.0; for (int i = 1; i <= 12; i++) { double v; cin >> v; res = res+v; } cout << fixed << setprecision(2) << "$" << res / 1
2017-08-19 16:00:23
394
原创 计蒜客“程序设计竞赛”之引言“A+B Problem”
#include <bits/stdc++.h>using namespace std;int main(){ int a,b; scanf("%d%d",&a,&b); printf("%d\n",a+b); return 0;}
2017-08-19 15:56:30
358
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人