Tag: problem: (B) Bash's Big Day Solve in C/C++

Codecraft-17 and Codeforces Round #391 (Div. 1 + Div. 2, combined), problem: (B) Bash’s Big Day Solution in C/C++

#include <stdio.h> int main(){ int n; scanf("%d",&n); int i, temp, max=1, freq={0}, ans=1, j; for(i=0;i<n;i++){ scanf("%d",&temp); freq++; if(temp>max){ max=temp; } } for(i=2; i<=max; ++i){ temp=0; for(j=i; j<=max; j+=i){ temp+=freq; } if(temp>ans) ans=temp; } printf("%d",ans); return 0; }

Want to stay up to date with the latest news?

We would love to hear from you! Please fill in your details and we will stay in touch. It's that simple!