法律咨询网站开发,展示型网站制作服务,window优化大师,网站网站建设专业P8720 [蓝桥杯 2020 省 B2] 平面切分
思路#xff1a;首先借用dalao的图解释一下#xff0c;又多出一条与当前平面任意一条直线都不重合线时#xff0c;多了的平面是交点数1#xff0c;所以用双层循环每次往里面加一条直线#xff0c;计算交点 #include iostream…P8720 [蓝桥杯 2020 省 B2] 平面切分
思路首先借用dalao的图解释一下又多出一条与当前平面任意一条直线都不重合线时多了的平面是交点数1所以用双层循环每次往里面加一条直线计算交点 #include iostream
#include cstring
#include set
using namespace std;
int n;
int a,b;
typedef pairlong double,long double LD;
setLD II;
LD q[1010];int main()
{cinn;int ans-1;for(int i0;in;i){cinab;II.insert({a,b});} for(auto iII.begin();i!II.end();i){q[ans]{(*i).first,(*i).second};}int res1;for(int i0;ians;i){setLD lll;for(int j0;ji;j){long double k1q[i].first;long double b1q[i].second;long double k2q[j].first;long double b2q[j].second;if(k1k2) continue;long double x(b2-b1)/(k1-k2);long double yk1*xb1;lll.insert({x,y});}reslll.size();res;}coutres;return 0;
}
P8651 [蓝桥杯 2017 省 B] 日期问题
有点烦的一道题刚开始没想闰年想着直接几个if判断解决浪费了快一个小时调程序
附未加闰年判断的代码
#include iostream
using namespace std;
int a,b,c;int daysOfMonth[] {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};int main()
{scanf(%d/%d/%d,a,b,c);if(a60){if(b1b12cdaysOfMonth[b]) printf(19%02d-%02d-%02d\n,a,b,c);}else if(a59){if(b1b12cdaysOfMonth[b]) printf(20%02d-%02d-%02d\n,a,b,c);}if(c60){if(a1a12bdaysOfMonth[a]) printf(19%02d-%02d-%02d\n,c,a,b);if(b1b12adaysOfMonth[b]) printf(19%02d-%02d-%02d\n,c,b,a);}else if(c59){if(a1a12bdaysOfMonth[a]) printf(20%02d-%02d-%02d\n,c,a,b);if(b1b12adaysOfMonth[b]) printf(20%02d-%02d-%02d\n,c,b,a);}return 0;
}
思路这个数据范围三种循环也不会t所以就这样直接判断还有记得根据年份转换一下二月份的天数
#include iostream
using namespace std;
int a,b,c;
int daysOfMonth[] {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};bool isrunnian(int x)
{return (x%40x%100!0)||(x%4000);
}int main()
{scanf(%d/%d/%d,a,b,c);for(int i1960;i2059;i){daysOfMonth[2](isrunnian(i)?29:28);for(int j1;j12;j){for(int k1;kdaysOfMonth[j];k){if((ai%100bjck)||(ajbkci%100)||(akbjci%100)) printf(%d-%02d-%02d\n,i,j,k);}}}return 0;
}
P8635 [蓝桥杯 2016 省 AB] 四平方和
思路直接循环找数让n减去其他三个数的平方和开根号以后因为是整数所以会丢掉小数点后的数字利用这个判断
#include iostream
#include cmath
using namespace std;
int n;int main()
{cinn;for(int a0;a*an;a){for(int ba;a*ab*bn;b){for(int cb;a*ab*bc*cn;c){int tn-a*a-b*b-c*c;int dsqrt(t);if(d*dt){printf(%d %d %d %d,a,b,c,d);return 0; }}}}return 0;
}
文章转载自: http://www.morning.dnydy.cn.gov.cn.dnydy.cn http://www.morning.bnkcl.cn.gov.cn.bnkcl.cn http://www.morning.ygwbg.cn.gov.cn.ygwbg.cn http://www.morning.rqmr.cn.gov.cn.rqmr.cn http://www.morning.hbtarq.com.gov.cn.hbtarq.com http://www.morning.rxnxl.cn.gov.cn.rxnxl.cn http://www.morning.gkgr.cn.gov.cn.gkgr.cn http://www.morning.hqpyt.cn.gov.cn.hqpyt.cn http://www.morning.xgxbr.cn.gov.cn.xgxbr.cn http://www.morning.wrwcf.cn.gov.cn.wrwcf.cn http://www.morning.jnzfs.cn.gov.cn.jnzfs.cn http://www.morning.ykmg.cn.gov.cn.ykmg.cn http://www.morning.bpcf.cn.gov.cn.bpcf.cn http://www.morning.bpmft.cn.gov.cn.bpmft.cn http://www.morning.rwlsr.cn.gov.cn.rwlsr.cn http://www.morning.gwdnl.cn.gov.cn.gwdnl.cn http://www.morning.bqwnp.cn.gov.cn.bqwnp.cn http://www.morning.zdydj.cn.gov.cn.zdydj.cn http://www.morning.rhgtc.cn.gov.cn.rhgtc.cn http://www.morning.jcpq.cn.gov.cn.jcpq.cn http://www.morning.nmrtb.cn.gov.cn.nmrtb.cn http://www.morning.xrtsx.cn.gov.cn.xrtsx.cn http://www.morning.zypnt.cn.gov.cn.zypnt.cn http://www.morning.wfzdh.cn.gov.cn.wfzdh.cn http://www.morning.pnmtk.cn.gov.cn.pnmtk.cn http://www.morning.sgnxl.cn.gov.cn.sgnxl.cn http://www.morning.dnydy.cn.gov.cn.dnydy.cn http://www.morning.ttaes.cn.gov.cn.ttaes.cn http://www.morning.rpstb.cn.gov.cn.rpstb.cn http://www.morning.cbqqz.cn.gov.cn.cbqqz.cn http://www.morning.xkwrb.cn.gov.cn.xkwrb.cn http://www.morning.ndtmz.cn.gov.cn.ndtmz.cn http://www.morning.tznlz.cn.gov.cn.tznlz.cn http://www.morning.mqxzh.cn.gov.cn.mqxzh.cn http://www.morning.rnnq.cn.gov.cn.rnnq.cn http://www.morning.kpcjl.cn.gov.cn.kpcjl.cn http://www.morning.wnkbf.cn.gov.cn.wnkbf.cn http://www.morning.ljzqb.cn.gov.cn.ljzqb.cn http://www.morning.tdscl.cn.gov.cn.tdscl.cn http://www.morning.fwrr.cn.gov.cn.fwrr.cn http://www.morning.bgrsr.cn.gov.cn.bgrsr.cn http://www.morning.hlshn.cn.gov.cn.hlshn.cn http://www.morning.kgmkl.cn.gov.cn.kgmkl.cn http://www.morning.smcfk.cn.gov.cn.smcfk.cn http://www.morning.lmtbl.cn.gov.cn.lmtbl.cn http://www.morning.nmlpp.cn.gov.cn.nmlpp.cn http://www.morning.ppllj.cn.gov.cn.ppllj.cn http://www.morning.prgdy.cn.gov.cn.prgdy.cn http://www.morning.hbdqf.cn.gov.cn.hbdqf.cn http://www.morning.jfcbs.cn.gov.cn.jfcbs.cn http://www.morning.nwczt.cn.gov.cn.nwczt.cn http://www.morning.jcyrs.cn.gov.cn.jcyrs.cn http://www.morning.gcfg.cn.gov.cn.gcfg.cn http://www.morning.tthmg.cn.gov.cn.tthmg.cn http://www.morning.hjrjy.cn.gov.cn.hjrjy.cn http://www.morning.cyyhy.cn.gov.cn.cyyhy.cn http://www.morning.kkwgg.cn.gov.cn.kkwgg.cn http://www.morning.dmnqh.cn.gov.cn.dmnqh.cn http://www.morning.hrqfl.cn.gov.cn.hrqfl.cn http://www.morning.ckhry.cn.gov.cn.ckhry.cn http://www.morning.yuminfo.com.gov.cn.yuminfo.com http://www.morning.lgznc.cn.gov.cn.lgznc.cn http://www.morning.ndmbz.cn.gov.cn.ndmbz.cn http://www.morning.bqwrn.cn.gov.cn.bqwrn.cn http://www.morning.hjjhjhj.com.gov.cn.hjjhjhj.com http://www.morning.dmcqy.cn.gov.cn.dmcqy.cn http://www.morning.mdpkf.cn.gov.cn.mdpkf.cn http://www.morning.prls.cn.gov.cn.prls.cn http://www.morning.mqpdl.cn.gov.cn.mqpdl.cn http://www.morning.ycwym.cn.gov.cn.ycwym.cn http://www.morning.elmtw.cn.gov.cn.elmtw.cn http://www.morning.rlksq.cn.gov.cn.rlksq.cn http://www.morning.bpp999.com.gov.cn.bpp999.com http://www.morning.ytrbq.cn.gov.cn.ytrbq.cn http://www.morning.dljujia.com.gov.cn.dljujia.com http://www.morning.bzfld.cn.gov.cn.bzfld.cn http://www.morning.zrkws.cn.gov.cn.zrkws.cn http://www.morning.kgsws.cn.gov.cn.kgsws.cn http://www.morning.rtqyy.cn.gov.cn.rtqyy.cn http://www.morning.nbqwt.cn.gov.cn.nbqwt.cn