2019/10/26 TZOJ
1001 Flooded Island
http://www.tzcoder.cn/acmhome/problemdetail.do?&method=showdetail&id=4521
把陆地四面其中三面被海洋环绕的‘@’标记。
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
char ma[][];
int dir[][]={-,,,,,-,,};
int main()
{
memset(ma,'.',sizeof(ma));
int n,m;scanf("%d%d",&n,&m);
for(int i=;i<=n;i++)
{
getchar();
for(int j=;j<=m;j++)
scanf("%c",&ma[i][j]);
}
int mini=,maxi=-,minj=,maxj=-;
for(int i=;i<=n;i++)
for(int j=;j<=m;j++)
{
int cnt=;
if(ma[i][j]=='X')
{
for(int k=;k<;k++)
{
int nowi=i+dir[k][],nowj=j+dir[k][];
if(ma[nowi][nowj]=='.') cnt++;
}
if(cnt>=) ma[i][j]='@';
}
if(ma[i][j]=='X')
{
mini=min(mini,i);
maxi=max(maxi,i);
minj=min(minj,j);
maxj=max(maxj,j);
}
}
//printf("%d %d %d %d\n",mini,maxi,minj,maxj);
for(int i=mini;i<=maxi;i++)
{
for(int j=minj;j<=maxj;j++)
printf("%c",ma[i][j]=='X'?'X':'.');
printf("\n");
}
}
1002 Buy Tickets
http://www.tzcoder.cn/acmhome/problemdetail.do?&method=showdetail&id=6018
线段树,我先跑了
1003 Strange fuction
http://www.tzcoder.cn/acmhome/problemdetail.do?&method=showdetail&id=6052
F(x) = 6 * x^7+8*x^6+7*x^3+5*x^2-y*x (0 <= x <=100),给一个y解出F(x)min(x∈[0,100])
求导,二分。
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
double f(double x,double y)
{
return *pow(x,6.0)+*pow(x,5.0)+*pow(x,2.0)+*x-y;
}
double ans(double x,double y)
{
return *pow(x,7.0)+*pow(x,6.0)+*pow(x,3.0)+*x*x-y*x;
}
int main()
{
int t;scanf("%d",&t);
while(t--)
{
double y;scanf("%lf",&y);
double mid,left=0.0,right=100.0;
while(right-left>1e-)
{
mid=(left+right)/2.0;
if(f(mid,y)<1e-) left=mid;
else right=mid;
}
printf("%.4f\n",ans(mid,y));
}
}
太难了。自动忽略1004。
1005 A sequence of numbers
http://www.tzcoder.cn/acmhome/problemdetail.do?&method=showdetail&id=6063
看a、b、c是等差数列还是等比数列,然后算第k个。等差数列没话说,等比数列快速幂,注意mod
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=;
ll f(ll a,ll b)
{
ll res=;
while(b)
{
if(b&) res=(res*a)%mod;
b>>=;
a=(a*a)%mod;
}
return res;
}
int main()
{
int t;scanf("%d",&t);
while(t--)
{
ll a,b,c,k,ans;scanf("%lld%lld%lld%lld",&a,&b,&c,&k);
if((a+c)==*b)
{
ll d=(b-a)%mod;
ans=(d*(k-)+a)%mod;
}
else{
ll q=(b/a)%mod;
ans=(f(q,k-)*a%mod)%mod;
}
printf("%lld\n",ans);
}
}
1006 GCD
http://www.tzcoder.cn/acmhome/problemdetail.do?&method=showdetail&id=6066
求满足__gcd(i,n)>=k的i的个数,将满足的因子欧拉函数累加
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int Eular(int n)
{
int res=n;
for(int i=;i*i<=n;i++)
if(n%i==)
{
res-=res/i;
while(n%i==) n/=i;
}
if(n>) res-=res/n;
return res;
}
int main()
{
int t;scanf("%d",&t);
while(t--)
{
ll ans=;
int i,n,k;scanf("%d%d",&n,&k);
for(i=;i*i<n;i++)
{
if(n%i==)
{
if(i>=k) ans+=Eular(n/i);
if(n/i>=k) ans+=Eular(i);
}
}
if(i*i==n&&i>=k) ans+=Eular(i);
printf("%lld\n",ans);
}
}
1007 Following Orders
http://www.tzcoder.cn/acmhome/problemdetail.do?&method=showdetail&id=6080
我又双叒叕跑了
1008 ST Task
角速度v来转这个杆子,第i秒的影子Lcos(v*PI/180.0*i),注意向下取整。
http://www.tzcoder.cn/acmhome/problemdetail.do?&method=showdetail&id=2632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define PI acos(-1)
int main()
{
int l,v;scanf("%d%d",&l,&v);
for(int i=;i<=/v;i++)
{
double l1=abs(l*cos(v*PI/180.0*i));
int ll=(int)(l1+0.5);
if(v*i<=)
{
for(int j=l-ll;j>=;j--) printf("S");
for(int j=ll;j>=;j--) printf("T");
for(int j=;j<l;j++) printf("S");
printf(" %.5f\n",l1*1.0/l*1.0/2.0);
}
else{
for(int j=;j<l;j++) printf("S");
for(int j=ll;j>=;j--) printf("T");
for(int j=l-ll;j>=;j--) printf("S");
printf(" %.5f\n",l1*1.0/l*1.0/2.0);
}
}
}
2019/10/26 TZOJ的更多相关文章
- 2019.10.26 CSP%您赛第三场
\(CSP\)凉心模拟^_^ --题源\(lqx.lhc\)等各位蒟蒻 题目名称 比赛 传递消息 开关灯 源文件名 \(competition.cpp\) \(message.cpp\) \(ligh ...
- 2019/10/27 TZOJ
1001 Gaussian Prime http://www.tzcoder.cn/acmhome/problemdetail.do?&method=showdetail&id=379 ...
- 6392. 【NOIP2019模拟2019.10.26】僵尸
题目描述 题解 吼题但题解怎么这么迷 考虑一种和题解不同的做法(理解) 先把僵尸离散化,h相同的钦(ying)点一个大小 (可以发现这样每种情况只会被算正好一次) 计算完全被占领的方案,然后1-方案/ ...
- 6389. 【NOIP2019模拟2019.10.26】小w学图论
题目描述 题解 之前做过一次 假设图建好了,设g[i]表示i->j(i<j)的个数 那么ans=∏(n-g[i]),因为连出去的必定会构成一个完全图,颜色互不相同 从n~1染色,点i的方案 ...
- 2019/10/13 TZOJ
水题虽不好,但是很爽 渴望未来某天能把剩下的题补了,先做个记录. Hard Disk Drive http://acm.hdu.edu.cn/showproblem.php?pid=4788 单位转化 ...
- 2019.10.26 csp-s模拟测试88 反思总结
今天的主人公是什么? 60.1K!!!! 先扔代码再更新防止我等会儿一上头不打算写完题解 T1: #include<iostream> #include<cstdio> #in ...
- Alpha冲刺(3/10)——2019.4.26
所属课程 软件工程1916|W(福州大学) 作业要求 Alpha冲刺(3/10)--2019.4.26 团队名称 待就业六人组 1.团队信息 团队名称:待就业六人组 团队描述:同舟共济扬帆起,乘风破浪 ...
- Beta冲刺(5/7)——2019.5.26
所属课程 软件工程1916|W(福州大学) 作业要求 Beta冲刺(5/7)--2019.5.26 团队名称 待就业六人组 1.团队信息 团队名称:待就业六人组 团队描述:同舟共济扬帆起,乘风破浪万里 ...
- 背水一战 Windows 10 (26) - XAML: x:DeferLoadStrategy, x:Null
[源码下载] 背水一战 Windows 10 (26) - XAML: x:DeferLoadStrategy, x:Null 作者:webabcd 介绍背水一战 Windows 10 之 XAML ...
随机推荐
- Codeforces 1159D The minimal unique substring(构造)
首先我们先观察三个串 10,1110,11101110,答案都是红色部分,我们可以下一个结论,形如 1,1101,111101,那么答案为红色部分.我们可以发现,通过我们末尾添加的1,导致之前红色部分 ...
- POJ-3468 A Simple Problem with Integers (区间求和,成段加减)
You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of op ...
- H-Updating a Dictionary (模拟)
In this problem, a dictionary is collection of key-value pairs, where keys are lower-case letters, a ...
- Kotlin学习(2)函数
函数声明: fun plus(a:Int,b:String):Boolean{ //fun 函数名(参数名:参数类型,参数名:参数类型):返回值类型 println(a) return true // ...
- linux相关(find/grep/awk/sed/rpm)
如何查找特定的文件: find :在指定目录下查找文件 find -name "filename" :从当前目录查找文件 find / -name "filename&q ...
- 20191115PHP cookie登入实例
首先是登入页面 <form action="" method="post"> <input type="text" nam ...
- 实现单选框点击label标记中的文字也能选中
实例: <label for="man"> <input type="radio" value="男" name=&quo ...
- 前端开发HTML&css入门——盒子模型以及部分CSS样式
CSS处理网页时,它认为每个元素都包含在一个不可见的盒子里.• 为什么要想象成盒子呢?因为如果把所有的元素都想象成盒子,那么我们对网页的布局就相当于是摆放盒子.• 我们只需要将相应的盒子摆放到网页中相 ...
- Scrapy抓取jobbole数据
1.python版本3.6.1 2.python编辑器:JetBrains PyCharm 2.安装virtualenvwrapper-win pip3 install virtualenvwrapp ...
- 【记录】mybatis mapper.xml 基础
<choose> <when test=""> //... </when> <otherwise> //... </other ...