2019江西省省赛

2019江西省省赛,第1张

概述  1 #include <bits/stdc++.h> 2 3 using namespace std; 4 typedef long long ll; 5 char c[1000]; 6 ll l,k1,k2,k3,k4,k,kk,d; 7 8 int main(){ 9 while (~scanf("%lld",&l)) {10

 

 1 #include <bits/stdc++.h> 2  3 using namespace std; 4 typedef long long ll; 5 char c[1000]; 6 ll l,k1,k2,k3,k4,k,kk,d; 7  8 int main(){ 9     while (~scanf("%lld",&l)) {10         scanf("%s",c);11         k1=k2=k3=k4=0;12         for (int i = 0; i < l; i++) {13             if (c[i] == a) k1++;14             if (c[i] == v) k2++;15             if (c[i] == i) k3++;16             if (c[i] == n) k4++;17         }18         k = k2 * k1 * k3 * k4;19         kk = l * l * l * l;20         if (k == 0) {21             printf("0/1\n");22             continue;23         }24         d = __gcd(k,kk);25         k = k / d;26         kk = kk / d;27         printf("%lld/%lld\n",kk);28     }29 }
VIEw Code

 

 1 #include <bits/stdc++.h> 2 using namespace std; 3  4 int a[2000],b[2000],c[2000],d[2000],t,f,n,m; 5 int main() { 6     while (~scanf("%d%d",&n,&m)) { 7         for (int i = 1; i <= n; i++) { 8             scanf("%d",&a[i]); 9         }10         for (int i = 1; i <= m; i++) {11             scanf("%d",&b[i]);12         }13         t=0;14         while (1) {15             memset(c,0,sizeof(c));16             memset(d,sizeof(d));17             for (int i = 1; i <= n; i++) {18                 c[a[i]] = 1;19             }20             for (int i = 1; i <= m; i++) {21                 d[b[i] + t] = 1;22             }23             f=0;24             for (int i=1;i<=1000;i++){25                 if (c[i]&&d[i]==1){26                     f=1;27                     break;28                 }29             }30             if (!f){31                 printf("%d\n",t);32                 break;33             }34             t++;35         }36     }37 }
VIEw Code

 

 

 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int mod = 1000000007; 4 long long quickpow(long long a,long long b) { 5     if (b < 0) return 0; 6     long long ret = 1; 7     a %= mod; 8     while(b) { 9         if (b & 1) ret = (ret * a) % mod;10         b >>= 1;11         a = (a * a) % mod;12     }13     return ret;14 }15 long long inv(long long a) {16     return quickpow(a,mod - 2);17 }18 int main() {19     long long  n;20     scanf("%lld",&n);21     long long ans=((n+1)*inv(2*n))%mod;22     printf("%lld\n",ans);23     return 0;24 }
VIEw Code

 

 

 1 #include <bits/stdc++.h> 2  3 using namespace std; 4 typedef long long ll; 5 ll n,b[1000],a[2000],m,lcm,x[2000],sum; 6  7 ll gcd(ll a,ll b){ 8     if (!b){ 9         return a;10     }11     return gcd(b,a%b);12 }13 int main() {14     while (~scanf("%lld%lld",&m)) {15         for (int i=1;i<=n;i++){16             scanf("%lld",&a[i]);17             b[a[i]]++;18         }19         lcm=1;20         for (int i=1;i<=10;i++){21             if (b[i]){22                 lcm=i/gcd(i,lcm)*lcm;23             }24         }25         for (int i=1;i<=n;i++){26             x[i]=lcm/a[i];27             sum+=x[i];28         }29         if (m%sum==0){30             k=m/sum;31             printf("Yes\n");32             for (int i=1;i<=n;i++){33                 printf("%lld",x[i]*k);34                 if (i==n){35                     printf("\n");36                 }else{37                     printf(" ");38                 }39             }40         }else{41             printf("No\n");42         }43     }44 }
VIEw Code

 

 

1 #include<bits/stdc++.h>2 using namespace std;3 4 int main()5 {6     int x,y;7     scanf("%d%d",&x,&y);8     printf("%d\n",(x*x-y*y)/4);9 }
VIEw Code

 

 1 #include <bits/stdc++.h> 2 using namespace std; 3 char c[100]; 4 double ans; 5 int n,l; 6 int main() { 7     while (~scanf("%d",&n)) { 8         ans=0; 9         for (int i = 1; i <= n; i++) {10             scanf("%s",&c);11             l = strlen(c);12             if (c[l - 1] < 5) {13                 ans -= 0.001 * (c[l - 1] - 0);14             } else {15                 ans += (10 - (c[l - 1] - 0)) * 0.001;16             }17         }18         printf("%.3lf\n",ans);19     }20 }
VIEw Code

 

 

 

 

 

总结

以上是内存溢出为你收集整理的2019江西省省赛全部内容,希望文章能够帮你解决2019江西省省赛所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1223104.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-05
下一篇 2022-06-05

发表评论

登录后才能评论

评论列表(0条)

保存