This commit is contained in:
Zengtudor 2025-07-15 08:35:00 +08:00
parent 9e696558fb
commit c49ccfe4fd
11 changed files with 53 additions and 0 deletions

38
src/7/15/U76012.cpp Normal file
View File

@ -0,0 +1,38 @@
#include <algorithm>
#include <cstdint>
#include <iostream>
#include <istream>
#include <vector>
using ll = int64_t;
const ll maxn = 100+5;
ll n,p,ans{};
std::vector<ll> a;
void cycle(ll bit){ //should be 128bit
ll sum{};
for(ll i=1;i<=n;i++){
if((1<<(i-1))&bit){
sum=(sum+a[i])%p;
}
}
ans=std::max(ans,sum);
}
int main(){
a.resize(maxn);
std::iostream::sync_with_stdio(false),std::cin.tie(nullptr),std::cout.tie(nullptr);
std::cin>>n>>p;
for (ll i=1;i<=n;i++) {
std::cin>>a[i];
a[i]%=p;
}
for(ll i=1;i<(1<<n);i++){
cycle(i);
}
std::cout<<ans<<'\n';
}

1
src/7/15/ez1.ans Normal file
View File

@ -0,0 +1 @@
3

2
src/7/15/ez1.in Normal file
View File

@ -0,0 +1,2 @@
4 4
5 2 4 1

1
src/7/15/ez2.ans Normal file
View File

@ -0,0 +1 @@
230

2
src/7/15/ez2.in Normal file
View File

@ -0,0 +1,2 @@
5 233
123 456 789 12 15

1
src/7/15/ez3.ans Normal file
View File

@ -0,0 +1 @@
196770

2
src/7/15/ez3.in Normal file
View File

@ -0,0 +1,2 @@
100 199999
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 159809 28847 121502 132630 104140

1
src/7/15/ez4.ans Normal file
View File

@ -0,0 +1 @@
894464500

2
src/7/15/ez4.in Normal file
View File

@ -0,0 +1,2 @@
25 894512298
2 2 2 2 2 2 2 2 2 2 2 21375541 214223121 103810246 319563281 312069633 379768697 221420761 216809506 215538633 101055241 49924705 138428641 90690479 28194612

1
src/7/15/ez5.ans Normal file
View File

@ -0,0 +1 @@
123455934

2
src/7/15/ez5.in Normal file
View File

@ -0,0 +1,2 @@
36 123456789
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 59232931 11805502 68108066 81881793 27773868 7023705 14750992 113974265 87975814 5609461 101043406 70525537 33127051 123398944 20732172 25360912 64331736