Search is not available for this dataset
name
stringlengths
2
112
description
stringlengths
29
13k
source
int64
1
7
difficulty
int64
0
25
solution
stringlengths
7
983k
language
stringclasses
4 values
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <cstdio> #include <algorithm> using namespace std; int main() { int i, n, m; int sum, array[1024]; while (1){ scanf("%d %d", &n, &m); if (!n && !m){ break; } for (i = 0; i < n; i++){ scanf("%d", &array[i]); } sort(array, array + n); reverse(array, array + n); for (i =...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <iostream> #include <fstream> #include <algorithm> #include <cassert> #include <cctype> #include <complex> #include <cstdio> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define rep(i,n) for(int i=0;i<n;i++) int n,m...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <iostream> #include <algorithm> #include <vector> using namespace std; int main() { int n, m; while(cin >> n >> m, n || m) { vector<int> v; for(int i = 0; i < n; i++) { int tmp; cin >> tmp; v.push_back(tmp); } sort(v.rbegin(), v.rend()); int res = 0; for(int i = 0; i < v.size(); i++) { ...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <cstdio> #include <iostream> #include <algorithm> using namespace std; int main(){ int i,j,n,m,a[1000],ans; while(1){ cin >> n >> m; if(n == 0 && m == 0) break; for(i=0;i<n;i++) cin >> a[i]; sort(a,a+n); ans = 0; j = 1; for(i=n-1;i>=0;i--){ if(j == m) j = 0; else a...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <iostream> #include <list> int main() { int num,bag,sum; while(std::cin >> num >> bag){ if(num!=0 && bag!=0){ std::list<int> beg; for(int i=0;i<num;++i){ int price; std::cin >> price; beg.push_back(price); } beg.sort(std::greater<int>()); sum=0; fo...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<bits/stdc++.h> using namespace std; int main(void){ int n,m,roop=0,ans[100]; while(cin>>n>>m&&n!=0&&m!=0){ int p[n],sum=0,h=n/m; for(int i=0;i<n;i++){ cin>>p[i]; sum+=p[i]; } sort(p,p+n); for(int i=1;i<=h;i++){ sum-=p[n-m*i]; ...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<iostream> #include<algorithm> using namespace std; int main(){ int data[1010]; int n,m; while(cin>>n>>m && n &&m){ for(int i=0;i<n;i++){ cin>>data[i]; } sort(data,data+n,greater<int>()); int ans=0; for(int i=0;i<n;i++){ if((i+1)%m!=0)ans+=data[i]; } cout<<ans<<endl; } }
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <iostream> #include <queue> int main(){ std::priority_queue<int> p; int n, m; int price; while(std::cin >> n >> m){ int sum_price = 0; if(n == 0 && m == 0) break; //input for(int i = 0; i < n; ++i){ std::cin >> price; p.push(price); } //袋詰め while(!p.empty()){ for(int i = 1; i <= m...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <stdio.h> #include <algorithm> using namespace std; int main(){ while (1){ int i,m,n,sum=0; int L[1000]; scanf("%d %d",&n,&m); if (n==0 && m==0) return 0; for (i=0;i<n;i++){ scanf("%d",&L[i]); sum+=L[i]; } sort(L,L+n); for (i=n-m;i>=0;i-=m) sum-=L[i]; pr...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
# -*- coding: utf-8 -*- while 1: try: n, m = map(int, input().split()) if n == 0: break p = sorted(list(map(int, input().split()))) p.reverse() for i in range(m - 1, n, m): p[i] = 0 print(sum(p)) except: break
PYTHON3
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<stdio.h> int main(){ int m,n,a[1000],i,k,st,c; while(1){ c=0; scanf("%d%d",&n,&m); if(n==0&&m==0)break; k=n; for(i=0;i<n;i++){ scanf("%d",&a[i]); } while(k!=0){ for(i=1;i<k;i++){ if(a[i-1]>a[i]){ st=a[i]; a[i]=a[i-1]; a[i-1]=st; } } k--; } for(i...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int n, m; while (cin >> n >> m, n|m) { vector<int> ps(n); for (int i = 0; i < n; i++) { cin >> ps[i]; } sort(ps.begin(), ps.end(), greater<int>()); int ans = 0; ...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<bits/stdc++.h> using namespace std; #define lp(i,n) for(int i=0;i<n;i++) int main(){ while(1){ int n,m; cin>>n>>m; if(n==0&& m==0) break; int a[1000]; lp(i,n){ cin>>a[i]; } sort(a,a+n); reverse(a,a+n); int ans=0; lp(i,n){ if((i+1)%m==0) continue; els...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
// 0227 #include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ while(1){ int n, m; vector<int> ve; cin>>n>>m; if((n == 0) && (m == 0 )) break; for(int i=0;i<n;i++){ int c; cin>>c; ve.push_back(c); } sort(ve.begin(), ve.end()); int cost = 0; for(in...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <bits/stdc++.h> using namespace std; int main() { int N, M; while (cin >> N >> M, N) { vector<int> p(N); int sum = 0; for (int i = 0; i < N; i++) { cin >> p[i]; sum += p[i]; } sort(p.begin(), p.end()); for (int i = N - M; i >= 0;...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <iostream> #include <algorithm> using namespace std; int main(void){ int n,m,p[1000]; while(1){ int sum = 0; cin >> n >> m; if( n == 0 && m == 0 ) break; for( int i = 0 ; i < n ; i++ ){ cin >> p[i]; sum += p[i]; } sort( p , p + n ); for( int i = n - m ; i >= 0 ; i -= m )...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <bits/stdc++.h> using namespace std; int main() { int n, m; int data[1001]; while( cin >> n >> m, n+m ) { for(int i=0; i<n; i++) { cin >> data[i]; } sort(data, data+n); int ans = 0; int cnt = 0; while( n > 0 ) { cnt++; n--; if( cnt == m ) { cnt = 0; ...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <iostream> #include <algorithm> #include <vector> using namespace std; typedef long long ll; int main() { int n,m,q; ll res; vector<ll> v; while(true) { cin >> n >> m; if(n == 0) break; v.clear(); res = 0; for(int i = 0; i < n; i++){ cin >> q; v.push_back(q); } ...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<bits/stdc++.h> using namespace std; int main(){ int n, m; while(cin >> n >> m, n, m){ int pn[1000]; for(int i = 0; i < n; i++) cin >> pn[i]; sort(pn, pn+n); int nowm = 0, ans = 0; for(int i = n-1; i >= 0; i--){ nowm++; if(nowm == m) nowm = 0; else{ ans += pn[i]; ...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<bits/stdc++.h> using namespace std; int main(){ int n,m; vector<int> p; while(true){ int ans = 0; cin >> n >> m; if(n + m == 0) break; p.resize(n); for(int i=0; i<n;++i){ cin >> p[i]; } sort(p.begin(), p.end()); reverse(p.begin(), p.end()); for(int ...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
import java.util.*; class Main { public static void main(String args[]) { try (Scanner sc = new Scanner(System.in)) { while (true) { int n = sc.nextInt(), m = sc.nextInt(), ans = 0; if (n == 0 && m == 0) { ...
JAVA
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <algorithm> #include <iostream> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int n, m; int p[1003]; void solve() { sort(p, p + n); reverse(p, p+n); int ans = 0; rep(i, n) ans += p[i]; for (int i = 0; i + m - 1 < n; i += m) { ans -= p[i + m - 1]; } ...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<cstdio> #include<algorithm> using namespace std; int main(){ while(1){ int n,m; scanf("%d%d",&n,&m); if(n == 0 && m == 0) break; int a[1001] = {0}; for(int i = 1; i <= n; i++){ scanf("%d",&a[i]); } sort(a+1,a+n+1); reverse(a+1,a+n+...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
import java.util.*; import static java.util.Arrays.*; class Main { int[] ns; int n, m; void run(){ Scanner in = new Scanner(System.in); for(;;){ n = in.nextInt(); m = in.nextInt(); if(n == 0) return; ns = new int[n]; for(int i=0; i<n; i++) ns[i] = in.nextInt(); System.out.println(solve()...
JAVA
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
import java.util.*; public class Main { public static void main ( String[] args ) { int n , m; Scanner sc = new Scanner(System.in); while ( true ) { int cost = 0; n = sc.nextInt(); m = sc.nextInt(); if ( n == 0 && m == 0 ) break; int[] deta = new int[1000]; for ( int i = 0; i < n; i++ ) de...
JAVA
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
import java.util.Scanner; class Main { public static void main(String args[]) { Scanner scan=new Scanner(System.in); while(true) { int n,m; n=scan.nextInt(); m=scan.nextInt(); if(n==0 && m==0)break; int p[]=new int[n]; for(int i=0;i<n;i++) { p[i]=scan.nextInt(); } for(int i=0;i<n-1;i++...
JAVA
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <cstdio> #include <algorithm> #include <vector> #include <numeric> #include <functional> using namespace std; #define rep(i,n) for(int i=0;i<n;i++) #define pb push_back int main() { while(1) { int n, m; scanf("%d %d", &n, &m); if(n == 0 && m == 0) break; vector<int> p; rep(i,n) { int t; scanf("%d"...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
# try-except is necessary for avoiding Runtime Error while 1: try: n,m=map(int,raw_input().split()) if n==0:break v=sorted(map(int,raw_input().split()))[::-1] for i in range(m-1,n,m): v[i]=0 print sum(v) except: pass
PYTHON
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<bits/stdc++.h> using namespace std; int main(){ int N,M; while(cin >> N >> M, N != 0){ vector<int> p(N); for(int i = 0; i < N; i++) cin >> p[i]; sort(p.rbegin(), p.rend()); int ans = 0; for(int i = 0; i < N; i++){ if((i+1) % M) ans += p[i]; ...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<iostream> #include<algorithm> #include<cstring> using namespace std; int main(){ int n,m,p; int d[1001]; int ans; while(true){ cin >> n >> m; if(!n && !m) break; memset(d,0,sizeof(d)); p = -1; ans = 0; for(int i=0;i<n;i++) cin >> d[i]; sort(d,d+n); reverse(d,d+n); ...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <iostream> #include <vector> #include <algorithm> int main() { int n, m; std::cin >> n >> m; while (n != 0 && m != 0) { int whole_price = 0; std::vector<int> vegi(n); for (auto &v : vegi) std::cin >> v; std::sort(vegi.begin(), vegi.end()); for (auto i = 1; i <= n; ++i) { whole_price += (i % m =...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <iostream> #include <algorithm> using namespace std; int main(){ int n, m, p; int data[1000]; while(1){ cin >> n >> m; if(n==0 && m==0) break; for(int i=0;i<n;i++){ cin >> data[i]; } sort(data, data+n); int sum=0; for(int i=n, count=0;i>=0;i--, count++){ if(c...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
import java.io.*; import java.math.BigInteger; import java.util.*; /** * @author yoshikyoto */ class Main extends MyUtil{ public static ArrayList<ArrayList<Integer>> g; public static void main(String args[]) throws Exception{ while(true){ int in[] = readIntMap(); int n = in[0], m = in[1]; if(in[0] ...
JAVA
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <cstdio> #include <vector> #include <algorithm> int main(){ int i,n,m,x; for(;scanf("%d%d",&n,&m),n;printf("%d\n",x)){ std::vector<int>v; for(i=0;i<n;i++)scanf("%d",&x),v.push_back(x); std::sort(v.begin(),v.end()); for(x=i=0;i<n;i++)x+=(i%m==n%m)?0:v[i]; } }
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
import java.util.Scanner; class Main { public static void main(String args[]) { Scanner scan=new Scanner(System.in); while(true) { int n,m; n=scan.nextInt(); m=scan.nextInt(); if(n==0 && m==0)break; int p[]=new int[n]; for(int i=0;i<n;i++) { p[i]=scan.nextInt(); } for(int i=0;i<n-1;i++...
JAVA
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<iostream> #include<vector> #include<algorithm> using namespace std; #define REP(i,b,n) for(int i=b;i<n;i++) #define rep(i,n) REP(i,0,n) #define ALL(c) (c).begin(),(c).end() #define pb push_back int main(){ int n,m; while(cin>>n>>m && n){ vector<int> a(n); rep(i,n)cin>>a[i]; sort(ALL(a));rev...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<algorithm> #include<iostream> #include<vector> int main() { int n, m; while( std::cin >> n >> m, n | m ) { std::vector<int> v( n ); for( int i = 0; i != n; ++i ) { int p; std::cin >> p; v.push_back( p ); } std::sort( v.rbegin(), v.rend() ); int ans = 0; for( int i = 0; i != n; ++...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<iostream> #include<algorithm> #include<functional> int *v,m,n,ans=0; int main(){ while(true){ std::cin >> n >> m; if(!n && !m) return 0; v = new int[n]; for(int i=0 ;i<n; i++) std::cin >> v[i]; std::sort(v,v+n,std::greater<int>()); if(m!=1) for(int i=0; i<n; i++) if(!((i+1)%m == 0 &...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <iostream> #include <queue> int main(){ int n,m; while(std::cin >> n >> m){ if(n == 0 && m == 0){ break; } std::priority_queue<int> vegetable; int each_price; for(int i = 0; i < n; ++i){ std::cin >> each_price; vegetable.push(each_price); } int sum_price = 0; for(int i = 0; i < n; +...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <bits/stdc++.h> #define FOR(v, s, t) for(int v = s; v < t; ++v) using namespace std; int main(){ int n, m, min; vector< int > p; while(cin >> n >> m, n){ p.resize(n); FOR(i, 0, n) cin >> p[i]; sort(p.begin(), p.end()); reverse(p.begin(), p.end()); min = 0; FOR(i, 0, n){ if((i + 1) % ...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<iostream> #include<algorithm> #include<vector> using namespace std; int main() { int n,m; for(;cin>>n>>m,n;) { vector<int> price; for(int i=0;i<n;i++) { int tmp; cin>>tmp; price.push_back(tmp); } sort(price.begin(),price.end()); int ans=0; int cnt=1; fo...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#define _USE_MATH_DEFINES #include "bits/stdc++.h" #define EPS 1e-10 using namespace std; typedef long long llong; int main() { int n, m; while (cin >> n >> m, m) { vector<int>p(n); for (int i = 0; i < n; i++)cin >> p[i]; sort(p.rbegin(), p.rend()); int sum = 0; for (int i = 0; i < n; i++) { if ((i + 1) ...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<iostream> #include<algorithm> using namespace std; int main(){ int m, n; while(1){ cin >> n >> m; if(n == 0 && m == 0)break; int data[n]; for(int i = 0; i < n; i++){ cin >> data[i]; } sort(data, data+n); reverse(data, data+n); for(int i = m-1; i < n - (n%m...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <iostream> #include <queue> int main(){ std::priority_queue<int> price; int n,m; while(std::cin >> n >> m){ int sum = 0; if(n == 0 && m == 0){ break; } for(int i = 0; i < n; ++i){ int temp; std::cin >> temp; price.push(temp); } for(int i = 1; i <= n; ++i){ ...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <stdio.h> #include <algorithm> using namespace std; const int N=1e5+10; int main(){ int n,m,a[N],ans; while(true){ scanf("%d%d",&n,&m); if(n==0&&m==0)return 0; ans=0; for(int i=0;i<n;i++)scanf("%d",&a[i]); sort(a,a+n); reverse(a,a+n); for(int i=0;...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <cstdio> #include <algorithm> #include <iostream> #include <vector> #include <string> #include <cmath> using namespace std; int main(){ int n,m,v,ans; while(1){ vector<int> b ; ans=0; cin >> n >> m ; if( (n==0) && (m==0) ){ return 0; } for(int i=0;i<n;i++){ cin >> v; ans += v; b.pus...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<iostream> #include<vector> #include<algorithm> #include<numeric> using namespace std; int main(){ while(1){ int n, m; cin >> n >> m; if(n + m == 0) break; vector<int> p(n); for(int i = 0; i < n; i++) cin >> p[i]; sort(p.begin(), p.end()); ...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
# Aizu Problem 0227: Thanksgiving import sys, math, os, bisect # read input: PYDEV = os.environ.get('PYDEV') if PYDEV=="True": sys.stdin = open("sample-input.txt", "rt") while True: n, m = [int(_) for _ in input().split()] if n == m == 0: break prices = sorted([int(_) for _ in input().split...
PYTHON3
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <iostream> #include <algorithm> #include <vector> int main(){ int n, m; while(std::cin >> n >> m, n){ int total = 0; std::vector<int> pvec; for(int i=0;i<n;i++){ int p; std::cin >> p; pvec.push_back(p); total += p; } std::sort(pvec.begin(), pvec.end(), std::greater<int>()); int i =...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<iostream> #include<algorithm> #include<vector> using namespace std; int main(){ int n,m,p; while(true){ cin >> n >> m; if(n+m == 0)break; vector<int> vec; for(int i=0;i<n;i++){ cin >> p; vec.push_back(p); } sort(vec.begin(),vec.end(),greater<int>() ); int sum = 0,...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<bits/stdc++.h> using namespace std ; int main(){ int n , m ; int c[1010] ; while( cin >> n >> m , n , m ){ for( int i=0 ; i<n ; i++ ) cin >> c[i] ; sort(c,c+n,greater<int>()) ; int sum = 0 ; for( int i=0 ; i<n ; i++ ){ if( (i+1)%m ) sum += c[i] ; } cout << sum << endl ; } }
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; int n, m; int p[1010]; int main() { cin.tie(0); ios_base::sync_with_stdio(false); cout << fixed << setprecision(10); while (cin >> n >> m, n) { for (int i = 0; i < n; i++) { cin >> p[i]; } sort...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<bits/stdc++.h> using namespace std; int main(){ while(1){ int n,m; int p[10000]; int sum=0; cin>>n>>m; if(n==0 && m==0) break; for(int i=0;i<n;i++){ cin>>p[i]; } for(int i=0;i<n;i++){ for(int j=0;j<n-1;j++){ if(p[j]<p[j+1]) swap(p[j],p[j+1]); } } for(int i=0;i<n;i++)...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <iostream> #include <algorithm> using namespace std; int main() { int n,m; int p[10000]; while(cin >> n >> m){ if(n == 0 && m == 0) break; for(int i=0;i<n;i++){ cin >> p[i]; } int sum = 0; int count = 1; sort(p,p+n); for(int i=n-1;i>=0;i--){ if(count%m!=0) sum += p[i]; count++...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<iostream> using namespace std; int main(){ int n,m; while(1){ int ans=0,p[10001]={}; cin>>n>>m; if(n+m==0)break; for(int i=1;i<=n;i++){ cin>>p[i]; } for(int j=0;j<n;j++) for(int i=1;i<=n;i++) if(p[i]<p[i+1])swap(p[i],p[i+1]); for(int i=1;i<=n;i++){ if(i%m==0)p[i]=0; ...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<bits/stdc++.h> using namespace std; bool cmp(const int &p1, const int &p2) { return p1 > p2; } int main() { int n, m, sum; int price[1000]; while (cin >> n >> m, n) { memset(price, 0, sizeof(price)); for (int i = 0; i < n; ++i) { cin >> price[i]; } sort(price, price + n,cmp); sum = 0; ...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <iostream> #include <vector> #include <algorithm> int main(){ int n,m; int p; while(true){ std::cin >> n >> m; if(n == 0 && m == 0){ break; } std::vector<int> price; for(int i=0; i<n ;++i){ std::cin >> p; price.push_back(p); } //sort in descending order std::sort(price.begin()...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <iostream> #include <algorithm> using namespace std; int main() { int i,s,m,n,d[1000]; while(cin >> n >> m && n!=0) { for (i=0,s=0;i<n;i++) { cin >> d[i]; s+=d[i]; } sort(d,d+n,greater<int>()); for (i=m-1;i<n;i+=m) s-=d[i]; cout << s << endl; } return 0; }
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<iostream> #include<algorithm> using namespace std; int main(){ int n,m; while(cin>>n>>m,n){ int a[1000],ans=0; for(int i=1;i<=n;i++){ cin>>a[i]; } sort(a+1,a+n+1); reverse(a+1,a+n+1); for(int i=1;i<=n;i++){ if(i%m!=0)ans+=a[i]; ...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
// 2011/01/08 Tazoe #include <iostream> using namespace std; int main() { while(true){ int n, m; cin >> n >> m; if(n==0&&m==0) break; int p[1000]; for(int i=0; i<n; i++) cin >> p[i]; for(int i=0; i<n-1; i++) for(int j=i+1; j<n; j++) if(p[i]<p[j]){ int tmp = p[i]; p[i] = p[j]; ...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<iostream> #include<algorithm> #include<functional> using namespace std; int main(){ int n,m,a[11111]; while(1){ cin >> n >> m; if(n == 0 && m == 0) break; int total = 0; for(int i=0;i<n;i++){ cin >> a[i]; total += a[i]; } sort(a,a+n,greater<int>() ); for(int i=m-1;i...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <iostream> #include <vector> #include <algorithm> using namespace std; #define rep(i,n) for(int i=0;i<n;i++) int main(){ int n,m; while(cin >> n >> m , n){ vector<int> data(n); int ret = 0; rep(i,n)cin >> data[i]; sort(data.begin(),data.end(),greater<int>()); rep(i,n){ if((i+1)%m==0)continu...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <bits/stdc++.h> using namespace std; #define rep(i, j) for(int i = 0; i < j; ++i) #define INF (1 << 30) #define MAX 10000 int main() { int n, m, p[MAX]; while(cin >> n >> m, n || m) { int total = 0; rep(i, n) { cin >> p[i]; total += p[i]; } sort(p, p + n); for(int i = n - m; i >= 0; i -= m...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <iostream> #include <string> #include <algorithm> #define rep(i,n) for(int i=0;i<n;++i) using namespace std; int a[1010]; int main(){ int n,m; while(cin >> n >> m,n){ rep(i,n) cin >> a[i]; int sum=0; rep(i,n) sum+=a[i]; sort(a,a+n); for(int i=n-m;i>=0;i-=m) sum-=a[i]; cout << sum << endl; } ...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <iostream> #include <vector> #include <algorithm> int main(){ int n, m; while(std::cin >> n >> m){ if(n == 0 && m == 0){ break; } std::vector<int> price(n, 0); int sum_price = 0; //全ての値段の合計 for(int i = 0 ; i < n ; ++i){ std::cin >> price[i]; sum_price += price[i]; } std::sort(pr...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); ArrayList<Integer> list = new ArrayList<Integer>(); int n,m,sum,count; while(true){ list.clear(); n = sc.nextInt(); m = sc...
JAVA
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <iostream> #include <cstdio> #include <algorithm> #include <array> #include <vector> #include <functional> using namespace std; int main() { while( true ) { int n, m; cin >> n >> m; if ( n == 0 && m == 0 ) break; vector<int> xs( n ); for ( int i = 0; i < n; i++ ) { cin >> xs[ i ]; } sort( xs.beg...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<iostream> #include<algorithm> using namespace std; int n,m,a[1000]; int main() { while(cin>>n>>m,n) { int ans=0; for(int i=0;i<n;i++) { cin>>a[i]; ans+=a[i]; } sort(a,a+n); for(int i=n-m;i>=0;i-=m) { ans-=a[i]; } cout<<ans<<endl; } }
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <cstdio> #include <algorithm> using namespace std; int main() { int n, m; while (scanf("%d %d", &n, &m), n != 0 && m != 0){ int p[1024]; for (int i = 0; i < n; i++){ scanf("%d", &p[i]); } sort(p, p+n); reverse(p, p+n); for (int i = 0; i < n; i++){ if ((i + 1) % m == 0){ ...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
import java.util.Scanner; class Main { public static void main(String[] args){ Scanner scan = new Scanner(System.in); int n, m; int[] bag; int p; int v, j; int ans; while(true){ n = scan.nextInt(); m = scan.nextInt(); if(n == 0 && m == 0)break; bag = new int[n]; ans = 0; for(int...
JAVA
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for(int i=(a); i<(b); i++) #define REP(i, n) FOR(i, 0, n) int main(){ while(1){ int n, m; cin>>n>>m; if(n==0) break; int a[n]; REP(i, n) cin>>a[i]; sort(a, a+n, greater<int>()); int sum = 0; REP(i, n) sum+=a[i]; for(int i=m-1; i<n; ...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <iostream> #include <algorithm> using namespace std; int main(void) { int n,m; int res; while(1) { cin >> n >> m; if(n == 0 && m == 0) break; res = 0; int p[n]; for(int i = 0; i < n; i++) cin >> p[i]; stable_sort(p, p + n); for(int i = n-1; i >= 0; ) ...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
while True: try: n,m = list(map(int,input().split())) if n == 0 and m == 0: break amari = n % m yasai = list(map(int,input().split())) yasai.sort() s = 0 for i in range(n): if (i+1) % m > 0: s += yasai[-i-1] pr...
PYTHON3
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<stdio.h> #include<algorithm> using namespace std; int table[1000]; int main(){ int a,b; while(scanf("%d%d",&a,&b),a){ int sum=0; for(int i=0;i<a;i++){ scanf("%d",table+i); sum+=table[i]; } std::sort(table,table+a); for(int j=a-b;j>=0;j-=b)sum-=table[j]; printf("%d\n",sum); } }
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <bits/stdc++.h> using namespace std; int main() { int n, m; while(cin >> n >> m, n || m){ int p[1001]; for(int i = 0; i < n; i++) cin >> p[i]; sort(p, p + n, greater<int>()); int ans = 0; for(int i = 0; i < n; i++){ if((i+1)%m == 0) continue; ans += p[i]; } cout <<...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <bits/stdc++.h> #define r(i,n) for(i=0;i<n;i++) using namespace std; int main(){ int a,b,i; while(cin>>a>>b,a){ int c[a],s=0,k=0,p=0; r(i,a){cin>>c[i];p+=c[i];} sort(c,c+a); for(i=a-1;i>=0;i--){ k++; if(k==b){ s+=c[i]; k=0; } } cout<<p-s<<endl;; }...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <bits/stdc++.h> using namespace std; int main() { while (true) { int n, m; cin >> n >> m; if (n==0 && m==0) { break; } int p[n]; int s = 0; for (int i=0; i<n; i++) { cin >> p[i]; s += p[i...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <iostream> #include <algorithm> using namespace std; int main() { int n, m; int p[1000]; cin >> n >> m; while (n != 0 || m != 0) { for (int i = 0; i < n; i++) cin >> p[i]; sort(p, p + n, greater<int>()); int s = 0; for (int i = 0; i < n; i++) { if (i % m != m - 1) s += p[i]; } ...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <iostream> #include <algorithm> #include <functional> using namespace std; int main(int argc, char const* argv[]) { int n,m; int place[1000]; while( cin >> n >> m && n != 0 ){ for( int i = 0;i < 1000;i++ ) place[i] = 0; for( int i = 0;i < n;i++ ) cin >> place[i]; sort( place, place + n, greater<in...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<iostream> #include<cstdio> #include<algorithm> #include<string> using namespace std; int N,M; int P[1000]; int main() { while(true){ scanf("%d%d",&N,&M); if(N==0&M==0)break; for(int i=0;i<N;i++)scanf("%d",&P[i]); sort(P,P+N);reverse(P,P+N); int ans=0; for(int i=0;i<N;i++){ if(i%M!=M-1)ans+=P[i]...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
//48 #include<iostream> #include<algorithm> #include<functional> using namespace std; int main(){ for(int n,m;cin>>n>>m,n|m;){ int p[1000]; for(int i=0;i<n;i++){ cin>>p[i]; } sort(p,p+n,greater<int>()); int cost=0; int h=0; for(int i=0;i<n;i++){ h++; if(h%m){ cost+=p[i...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<bits/stdc++.h> using namespace std; int main() { int n,m; while(cin>>n>>m,n,m){ int vege[1000]; for(int i=0;i<n;i++)cin>>vege[i]; sort(vege,vege+n); for(int i=1;n-m*i>=0;i++)vege[n-m*i]=0; for(int i=1;i<n;i++)vege[0]+=vege[i]; cout<<vege[0]<<endl; } }
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<cstdio> #include<algorithm> using namespace std; int main(){ while(1){ int sina[1000],n,m,sum=0; scanf("%d%d",&n,&m); if(n==0&&m==0)return 0; for(int i=0;i<n;i++){ scanf("%d",&sina[i]); sum+=sina[i]; } sort(sina,sina+n); for(int i=n-m;i>=0;i-=m){ sum-=sina[i]; } printf("%d\n",sum); } }
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <iostream> #include <algorithm> #include <numeric> #include <functional> int main(){ int n, m; while (std::cin >> n >> m, n || m){ int data[1001]; for (int i = 0; i < n; i++)std::cin >> data[i]; std::sort(data, data + n, std::greater<int>()); int ans = 0; for (int i = m - 1; i < n; i += m)ans +...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<iostream> #include<algorithm> using namespace std; int main(void) { int n, m, p[10000]; while (cin >> n >> m) { if (n == 0 && m == 0) break; int sum = 0; for (int i = 0; i < n; i++) { cin >> p[i]; sum += p[i]; } sort(p, p + n); for (int i = n - m; i >= 0; i -= m) sum -= p[i]; cout << ...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
import java.util.*; class Main{ public static void main(String[] args){ Solve s = new Solve(); s.solve(); } } class Solve{ Solve(){} Scanner in = new Scanner(System.in); void solve(){ while(in.hasNext()){ int n = in.nextInt(), m = in.nextInt(); if(n == 0 && m == 0) return; int[] a = new int[n...
JAVA
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args){ try(Scanner sc=new Scanner(System.in)){ while(sc.hasNext()) { int n=sc.nextInt(); int m=sc.nextInt(); if((n|m)==0) break; int[] p=new int[n]; for(int i=0; i<n; i++) { p[i]=sc.ne...
JAVA
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <iostream> #include <queue> int main(){ std::priority_queue<int> price; int n,m; while(std::cin >> n >> m){ int sum = 0; if(n == 0 && m == 0){ break; } for(int i = 0; i < n; ++i){ int temp; std::cin >> temp; price.push(temp); } for(int i = 1; i <= n; ++i){ if...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; i--) int n, m; int p[1010]; int main() { while (cin >> n >> m, n){ rep(i, n) cin >> p[i]; sort(p, p + n, greater<int>()); int res = 0; rep(i, n) res += p[i...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <iostream> #include <vector> #include <algorithm> int main(){ int num,cap,price,i; while(std::cin >> num >> cap){ if(num == 0 && cap == 0){ break; } std::vector<int> vegetables; for(i=0; i<num; ++i){ std::cin >> price; vegetables.push_back(price); } sort(vegetables.begin(), vegetab...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <iostream> #include <vector> #include <algorithm> int main(void){ int n,m; while(std::cin >> n >> m && n!=0 && m!=0){ std::vector<int> veg; for(int i=0;i<n;i++){ int tmp; std::cin >> tmp; veg.push_back(tmp); } std::sort(veg.begin(),veg.end(),std::greater<int>()); int...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <iostream> #include <algorithm> using namespace std; int main() { int n, m, p[1001]; while(1){ cin >> n >> m; if(n == 0 && m == 0){ break; } for(int i = 0; i < n; i++){ cin >> p[i]; } sort(p, p+n); int s=0; for(int i = n-1, j=1; i >= 0; i--, j++){ if(j ...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<iostream> #include<vector> #include<algorithm> using namespace std; int main() { int n, m, p, ans; vector<int> pv; while(1) { cin >> n >> m; if(!n&&!m) break; pv.clear(); ans = 0; for(int i=0; i<n; ++i) { cin >> p; pv.push_back(p); } sort(pv.begin(), pv.end(), greater<int>()); for(int i=0; ...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <cstdio> #include <algorithm> using namespace std; int main(){ int n,m,p[1000]; while(scanf("%d%d",&n,&m), n != 0){ for(int i=0; i<n;i++){ scanf("%d",&p[i]); } sort(p,p+n); int sum = 0; int it = 0; for(int i = n-1; i >= 0; i--,it++){ if(it % m != m-1) sum += p[i]; } printf("%d\n",s...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include <iostream> #include <queue> int main(){ int n,m; while(std::cin >> n >> m){ if(n == 0 && m == 0){ break; } std::priority_queue<int> que; int vegetable; for(int i = 0; i < n; ++i){ std::cin >> vegetable; que.push(vegetable); } int price = 0; for(int i = 0; i < n; ++i){ if((i % ...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); while (stdIn.hasNext()) { int n = stdIn.nextInt(); int m = stdIn.nextInt(); if (n != 0 ||m != 0) { int a[] = new int[n]; for (int i = 0; i < n; i++) { a[i] = stdIn.ne...
JAVA
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
import java.util.Scanner; import java.util.Arrays; public class Main{ public static void main(String[] args){ Scanner scan = new Scanner(System.in); while(scan.hasNext()){ int n = scan.nextInt(); int m = scan.nextInt(); if(n == 0 && m == 0){ break; } int[] p = new int[n]; int sum = 0; for(...
JAVA
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
#include<iostream> #include<algorithm> using namespace std; int main(){ int n,m,a[1000],sum,dis,p; while(1){ sum=0; dis=0; cin >>n>>m; if( n == 0 && m == 0 )break; for(int i=0 ; i < n ; i++){ cin >>a[i]; sum+=a[i]; } sort(a,a+n); for(in...
CPP
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
import java.util.Arrays; import java.util.Scanner; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { while(true){ int n = sc.nextInt(); int m = sc.nextInt(); if(n == 0 && m == 0){ break; } int[] vegetable = new int[n]; for(int i = 0; i < ...
JAVA
p00227 Thanksgiving
As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices. One day, a group of three good friends living in the Matsunaga housing complex bloomed with a...
7
0
import sys f = sys.stdin while True: n, m = map(int, f.readline().split()) if n == 0: break vegitables = sorted(map(int, f.readline().split()), reverse=True) discount = sum(vi for i, vi in enumerate(vegitables) if (i + 1) % m == 0) print(sum(vegitables) - discount)
PYTHON3