2020-01-18 小白月賽
5/10
總結:笨比操作多而且致命,菜是原罪。
A
已知三角形三點坐標,算外心坐標
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
using namespace std;
typedef long long ll;
const int MAX=100001;
const int INF=0x3f3f3f3f;
const int mod=1000000007;
double x[4],y[4];
double a,b;
int main()
{
for(int i=1;i<=3;i++)
{
scanf("%lf%lf",&x[i],&y[i]);
}
double k2=(x[1]-x[3])/(y[3]-y[1]);
double k1=(x[1]-x[2])/(y[2]-y[1]);
double midy1=(y[1]+y[2])/2;
double midy2=(y[1]+y[3])/2;
double midx1=(x[1]+x[2])/2;
double midx2=(x[1]+x[3])/2;
double j=(midx1*k1-midx2*k2+midy2-midy1)/(k1-k2);
printf("%.3f %.3f",j,k1*(j-midx1)+midy1);
return 0;
}
C

以為數據范圍是到6*10^100次冪,就干了一整晚大數。~ ~ ~ / / / ( ^ v ^ ) \ \ \ ~ ~ ~
其實就是個水題long long(然鵝花了一個小時還沒寫完。。)
ll a,b;
while(cin>>a>>b)
{
a=a-1;
ll num1=a/60*50+min(50*1LL,a%60);
ll num2=b/60*50+min(50*1LL,b%60);
cout<<num2-num1<<endl;
}
當大數的練習題來寫,通過6%的數據,待更
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string.h>
#include <cmath>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <stack>
using namespace std;
typedef long long ll;
const int MAX=10005;
const int INF=0x3f3f3f3f;
const int mod=1000000007;
struct node
{
int d[1050];
int len;
node()
{
memset(d,0,sizeof(d));
len=0;
}
};
char str1[1000],str2[1000];
node change(char str[])
{
node a;
a.len=strlen(str);
for(int i=0;i<a.len;i++)
{
a.d[i]=str[a.len-1-i]-'0';
}
return a;
}
node add(node a,node b)
{
node c;
int carry=0;
for(int i=0;i<a.len||i<b.len;i++)
{
int temp=a.d[i]+b.d[i]+carry;
c.d[c.len++]=temp%10;
carry=temp/10;
}
if(carry!=0)
{
c.d[c.len++]=carry;
}
return c;
}
node sub(node a,node b)
{
node c;
for(int i=0;i<a.len||i<b.len;i++)
{
if(a.d[i]<b.d[i])
{
a.d[i+1]--;
a.d[i]+=10;
}
c.d[c.len++]=a.d[i]-b.d[i];
}
while(c.len-1>=1&&c.d[c.len-1]==0)
{
c.len--;
}
return c;
}
node multi(node a,int b)
{
node c;
int carry=0;
for(int i=0;i<a.len;i++)
{
int temp=a.d[i]*b+carry;
c.d[c.len++]=temp%10;
carry=temp/10;
}
while(carry!=0)
{
c.d[c.len++]=carry%10;
carry/=10;
}
return c;
}
node chu(node a,int b)
{
node c;
c.len=a.len;
int r=0;
for(int i=a.len-1;i>=0;i--)
{
r=r*10+a.d[i];
if(r<b)
c.d[i]=0;
else
{
c.d[i]=r/b;
r=r%b;
}
}
while(c.len-1>=1&&c.d[c.len-1]==0)
{
c.len--;
}
return c;
}
int getint(node a)
{
int sum=0;
for(int i=a.len-1;i>=0;i--)
{
sum=sum*10+a.d[i]-'0';
}
return sum;
}
void print(node a)
{
for(int i=a.len-1;i>=0;i--)
{
printf("%d",a.d[i]);
}
}
node dotime(char str[])
{
node b=change(str);
node cs=chu(b,60);
node ys=sub(b,multi(cs,60));
node d;
if(getint(ys)>=50)
{
//加五十
d=add(multi(cs,50),change("50"));
}
else
{
//加余數
d=add(multi(cs,50),ys);
}
return d;
}
int main()
{
ll a,b;
while(cin>>a>>b)
{
a=a-1;
ll num1=a/60*50+min(50*1LL,a%60);
ll num2=b/60*50+min(50*1LL,b%60);
cout<<num2-num1<<endl;
}
return 0;
}
F
找規律。
H

WA了五發,四發"新年快樂!",真的新年快樂
J
廣搜題。
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string.h>
#include <cmath>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <stack>
using namespace std;
typedef long long ll;
const int MAX=105;
const int INF=0x3f3f3f3f;
const int mod=1000000007;
struct node
{
int x,y,z;
int step;
}S,T,Node;
int n;
char maze[MAX][MAX][MAX];
int book[MAX][MAX][MAX];
int x[6]={0,0,1,-1,0,0};
int y[6]={1,-1,0,0,0,0};
int z[6]={0,0,0,0,1,-1};
bool check(int a,int b,int c)
{
if(a>n||a<=0||b>n||b<=0||c>n||c<=0)
return false;
if(maze[a][b][c]=='*')
return false;
if(book[a][b][c]==1)
return false;
return true;
}
int BFS()
{
queue<node>q;
q.push(S);
while(!q.empty())
{
node top=q.front();
q.pop();
if(top.x==n&&top.y==n&&top.z==n)
return top.step;
for(int i=0;i<6;i++)
{
int newx=top.x+x[i];
int newy=top.y+y[i];
int newz=top.z+z[i];
if(check(newx,newy,newz))//位置有效
{
Node.x=newx,Node.y=newy,Node.z=newz;
Node.step=top.step+1;
q.push(Node);
book[newx][newy][newz]=1;
}
}
}
return -1;
}
int main()
{
scanf("%d",&n);
for(int k=1;k<=n;k++)
{
for(int i=1;i<=n;i++)
{
getchar();
for(int j=1;j<=n;j++)
{
scanf("%c",&maze[i][j][k]);
}
}
}
S.x=1;
S.y=1;
S.z=1;
S.step=0;
int numstep=BFS();
if(numstep==-1)
printf("-1\n");
else
printf("%d\n",numstep+1);
return 0;
}
智能推薦
牛客小白月賽22
H 貨物種類 思路: 差分 數組L用來記入該種類的貨物 R用來減去該種類的貨物 復雜度O(n) 參考Max_n J 計算A+B python水高精度是真的tql python牛逼~...
牛客小白月賽18 總結
T1~T4 都是比較簡單的水題了(實現和想的過程都挺簡單的) T7是樹狀數組 T5平衡樹打了FHQFHQFHQ但因為區間加出鍋考后A了 T6T9貌似都是數學結論題 T8圖論題 T10wdfwdfwdf??? SolutionSolutionSolution T1 Forsaken喜歡數論 描述: 設fif_ifi?表示每個數的最小質因子,求其前綴和 n≤3×107n\leq3\t...
牛客小白月賽21總結
牛客小白月賽21總結 PS:又是一場自閉場,前期跟榜,15分鐘左右迅速切了三道題,當時排名第5名( 還特意截了個圖去裝了個逼 ) (學校就不露了,一所雙非院校,哈哈哈) 但是后面真的好難受啊, 一直wa一直爽 是不可能的,搞的心態爆炸,然后看了看排名就一直在100名左右徘徊,最后一個小時就圍著E、J、I。我真的感覺E不是一般的無語,開始成績要保留整數然后四舍五入;最后的績點又是保留兩位小數四舍五入...
牛客 — 小白月賽28
發現小白月賽挺好,涉及到很多基礎算法,正好復習相關算法 傳送門 A. 牛牛和牛可樂的賭約 主要思路: 這題就是一個很基礎的求概率的題,用到了逆元(模板題),只要會逆元,就可以輕松解決。 解題思路: 首先每次投出n的概率都是 1 / n 1/n 1/n,所以投出 m 次 n 的概率就是 1 / n m 1/n^m 1/nm 所以,牛牛輸的概率為 1 - 1 / n m 1/n^m 1/nm, 很顯然...
牛客小白月賽17
牛客小白月賽 17 A 小 sun 的假期 題目描述 小 sun 非常喜歡放假,尤其是那種連在一起的長假,在放假的時候小 sun 會感到快樂,快樂值等于連著放假的天數,現在小 sun 把他的安排表告訴你,希望你告訴他在他的安排表中, 他的最大快樂值。 當某天沒有安排的時候就是放假。 輸入描述 第一行兩個數 n,m,代表總共有 n 天,m 個安排。 接下來有 m 行,每行是一個安排 l,r,代表從第...
猜你喜歡
牛客小白月賽1 I
あなたの蛙が帰っています 題目鏈接 這道題是考卡特蘭數的 題目描述 輸入描述: 第一行一個數 T ,表示蛙蛙有 T 組詢問。 接下去 T 行,每行一個正整數 N, 表示目的地的個數(入棧元素個數)。 1≤T≤200 1≤N≤10^5 輸出描述 輸出共 TT 行,每行一個答案,格式形如Case #1: 3 ,具體可見樣例。 答案可能較大,請對 998244353 取模后輸出。...
freemarker + ItextRender 根據模板生成PDF文件
1. 制作模板 2. 獲取模板,并將所獲取的數據加載生成html文件 2. 生成PDF文件 其中由兩個地方需要注意,都是關于獲取文件路徑的問題,由于項目部署的時候是打包成jar包形式,所以在開發過程中時直接安照傳統的獲取方法沒有一點文件,但是當打包后部署,總是出錯。于是參考網上文章,先將文件讀出來到項目的臨時目錄下,然后再按正常方式加載該臨時文件; 還有一個問題至今沒有解決,就是關于生成PDF文件...
電腦空間不夠了?教你一個小秒招快速清理 Docker 占用的磁盤空間!
Docker 很占用空間,每當我們運行容器、拉取鏡像、部署應用、構建自己的鏡像時,我們的磁盤空間會被大量占用。 如果你也被這個問題所困擾,咱們就一起看一下 Docker 是如何使用磁盤空間的,以及如何回收。 docker 占用的空間可以通過下面的命令查看: TYPE 列出了docker 使用磁盤的 4 種類型: Images:所有鏡像占用的空間,包括拉取下來的鏡像,和本地構建的。 Con...
requests實現全自動PPT模板
http://www.1ppt.com/moban/ 可以免費的下載PPT模板,當然如果要人工一個個下,還是挺麻煩的,我們可以利用requests輕松下載 訪問這個主頁,我們可以看到下面的樣式 點每一個PPT模板的圖片,我們可以進入到詳細的信息頁面,翻到下面,我們可以看到對應的下載地址 點擊這個下載的按鈕,我們便可以下載對應的PPT壓縮包 那我們就開始做吧 首先,查看網頁的源代碼,我們可以看到每一...