4 solutions
-
1
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ios::sync_with_stdio(false); cout<<"----./--.../--..."<<endl; return 0; } /** * ii. ;9ABH, * SA391, .r9GG35&G * &#ii13Gh; i3X31i;:,rB1 * iMs,:,i5895, .5G91:,:;:s1:8A * 33::::,,;5G5, ,58Si,,:::,sHX;iH1 * Sr.,:;rs13BBX35hh11511h5Shhh5S3GAXS:.,,::,,1AG3i,GG * .G51S511sr;;iiiishS8G89Shsrrsh59S;.,,,,,..5A85Si,h8 * :SB9s:,............................,,,.,,,SASh53h,1G. * .r18S;..,,,,,,,,,,,,,,,,,,,,,,,,,,,,,....,,.1H315199,rX, * ;S89s,..,,,,,,,,,,,,,,,,,,,,,,,....,,.......,,,;r1ShS8,;Xi * i55s:.........,,,,,,,,,,,,,,,,.,,,......,.....,,....r9&5.:X1 * 59;.....,. .,,,,,,,,,,,... .............,..:1;.:&s * s8,..;53S5S3s. .,,,,,,,.,.. i15S5h1:.........,,,..,,:99 * 93.:39s:rSGB@A; ..,,,,..... .SG3hhh9G&BGi..,,,,,,,,,,,,.,83 * G5.G8 9#@@@@@X. .,,,,,,..... iA9,.S&B###@@Mr...,,,,,,,,..,.;Xh * Gs.X8 S@@@@@@@B:..,,,,,,,,,,. rA1 ,A@@@@@@@@@H:........,,,,,,.iX: * ;9. ,8A#@@@@@@#5,.,,,,,,,,,... 9A. 8@@@@@@@@@@M; ....,,,,,,,,S8 * X3 iS8XAHH8s.,,,,,,,,,,...,..58hH@@@@@@@@@Hs ...,,,,,,,:Gs * r8, ,,,...,,,,,,,,,,..... ,h8XABMMHX3r. .,,,,,,,.rX: * :9, . .:,..,:;;;::,.,,,,,.. .,,. ..,,,,,,.59 * .Si ,:.i8HBMMMMMB&5,.... . .,,,,,.sMr * SS :: h@@@@@@@@@@#; . ... . ..,,,,iM5 * 91 . ;:.,1&@@@@@@MXs. . .,,:,:&S * hS .... .:;,,,i3MMS1;..,..... . . ... ..,:,.99 * ,8; ..... .,:,..,8Ms:;,,,... .,::.83 * s&: .... .sS553B@@HX3s;,. .,;13h. .:::&1 * SXr . ...;s3G99XA&X88Shss11155hi. ,;:h&, * iH8: . .. ,;iiii;,::,,,,,. .;irHA * ,8X5; . ....... ,;iihS8Gi * 1831, .,;irrrrrs&@ * ;5A8r. .:;iiiiirrss1H * :X@H3s....... .,:;iii;iiiiirsrh * r#h:;,...,,.. .,,:;;;;;:::,... .:;;;;;;iiiirrss1 * ,M8 ..,....,.....,,::::::,,... . .,;;;iiiiiirss11h * 8B;.,,,,,,,.,..... . .. .:;;;;iirrsss111h * i@5,:::,,,,,,,,.... . . .:::;;;;;irrrss111111 * 9Bi,:,,,,...... ..r91;;;;;iirrsss1ss1111 */
-
0
#include<bits/stdc++.h> using namespace std; typedef long long ll; int days[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; int cal(int x) { int sum=0; while(x) { sum+=x%10; x/=10; } return sum; } int judge(int a,int b,int c) { int sum=cal(a)+cal(b)+cal(c); return sum; } int main() { int ans=0,countt=0; for(int year=2001;year<=2021;++year) { if((year%4==0&&year%100!=0)||year%400==0) days[2]=29; else days[2]=28;//不能漏了= =,初始化 for(int month=1;month<=12;++month) { for(int day=1;day<=days[month];++day) { ans=judge(year,month,day); if(ans==1||ans==4||ans==9||ans==16||ans==25||ans==36||ans==49||ans==64) countt++; } } } cout<<countt<<"\n"; return 0; }
-
0
打卡
#include <bits/stdc++.h> #define mod 1000000007 #define ll unsigned long long int month[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; using namespace std; int solve(int x){ int ans=0; while(x){ ans+=x%10; x/=10; } return ans; } int main(){ ll sum=0; for(int i=2001;i<=2021;i++){ if((i%4==0&&i%100!=0)||i%400==0) month[2]=29; else month[2]=28; for(int k=1;k<=12;k++){ for(int s=1;s<=month[k];s++){ int ans=solve(i)+solve(k)+solve(s); if(sqrt(ans)==(int)sqrt(ans)){ sum++; } } } } cout<<sum; return 0; }
-
0
题目来源
2021年蓝桥杯国赛C题
题目链接:http://acm.mangata.ltd/p/P1504
考点
暴力枚举,常识or手数
视频讲解
视频连接:https://www.bilibili.com/video/BV15S4y1o78D/
思路
思路一
因为从2001年1月1日到2021年12月31日也就二十年,我们直接打开日历手动计数就好啦,肥肠的方便!
思路二
我们可以通过计算机辅助我们计算,我们开三重循环,分别模拟
year
、month
、day
,然后把每一天都拿来计算就好啦,然后要注意的是闰年的2月是29天,不过好在没有这一天是一个完全平方数。代码
#include<bits/stdc++.h> using namespace std; //----------------自定义部分---------------- #define ll long long #define mod 1000000009 #define endl "\n" #define PII pair<int,int> int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0}; ll ksm(ll a,ll b) { ll ans = 1; for(;b;b>>=1LL) { if(b & 1) ans = ans * a % mod; a = a * a % mod; } return ans; } ll lowbit(ll x){return -x & x;} const int N = 2e6+10; //----------------自定义部分---------------- int month_day[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};//每个月的天数 int f(int x){ int ans = 0; while(x) { ans += x % 10; x /= 10; } return ans; } bool check(int a,int b,int c){ int k = f(a) + f(b) + f(c); int p = sqrt(k);//默认向下取整的 return p * p == k; } int main() { int ans = 0; for(int year = 2001; year <= 2021; ++year){ if((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) month_day[2] = 29; else month_day[2] = 28; for(int month = 1;month <= 12; ++month){ for(int day = 1;day <= month_day[month]; ++day){ if(check(year,month,day)) ans++; } } } cout<<ans<<endl; return 0; }
- 1
Information
- ID
- 1843
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 4
- Tags
- # Submissions
- 38
- Accepted
- 18
- Uploaded By