2 solutions
-
0
Guest MOD
-
1
#include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); int T; cin>>T; while(T--){ int n; cin>>n; int cnt1=0,cnt2=0,cnt3=0; for(int i=1;i<=n;i++){ int x;cin>>x; if(x%3==1) cnt1++; if(x%3==2) cnt2++; if(x%3==0) cnt3++; } int c=min(cnt1,cnt2); cout<<(cnt3+c+((max(cnt1,cnt2)-min(cnt1,cnt2))/3))<<'\n'; } return 0; }
Information
- ID
- 212
- Time
- 2000ms
- Memory
- 512MiB
- Difficulty
- 4
- Tags
- (None)
- # Submissions
- 72
- Accepted
- 35
- Uploaded By