prompt string | response string |
|---|---|
Problem: 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 bloom... | #include <iostream>
#include <algorithm>
using namespace std;
int main(){
int n,m;
while(cin >> n >> m,n){
int p[1000],sum = 0;
for(int i = 0;i < n;i++) cin >> p[i];
sort(p,p + n,greater<int>());
for(int i = 0;i < n;i++){
if(i % m != m - 1) sum += p[i];
}
cout << sum << endl;
}
return 0;
} |
Problem: 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 bloom... | #include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int n,m,sum;
int p[1010];
while(cin >> n >> m,n!=0&&m!=0){
for(int i=0;i<n;i++){
cin >> p[i];
}
sort(p,p+n);
reverse(p,p+n);
sum = 0;
for(int i=0;i<n;i++){
if... |
Problem: 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 bloom... | #include<iostream>
using namespace std;
int main()
{
int n,m,i,j,p[1000];
for(;;)
{
cin >> n >> m;
if(n==0)
break;
int ans=0;
for(i=0;i<n;i++)
{
cin >> p[i];
}
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(p[i]<p[j])
{
int a;
a=p[i];
p[i]=p[j];
p[j]=a;
... |
Problem: 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 bloom... | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
while(cin >> n >> m, n){
vector<int> a(n);
for(int i=0;i<n;i++)cin >> a[i];
sort(a.begin(),a.end(),greater<int>());
int ans = 0;
for(int i=0;i<n;i++){
if((i+1)%m)ans += a[i];
}
cout << ans << endl;
}
} |
Problem: 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 bloom... | #include<cstdio>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;
int main(void){
int n,m;
while(scanf("%d %d", &n, &m) && n != 0 ){
vector<int > a;
int temp;
int ans = 0;
for(int i = 0; i < n; i++){
scanf("%d", &temp);
a.push_back(temp);
}
sort(a.begin(),a.... |
Problem: 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 bloom... | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
int n,m,ans,a,nk,count;
while(cin>>n>>m){
if(n==0&&m==0) break;
int p[n];
nk = n;
count = 0;
for(int i=0;i<n;i++) cin >> p[i];
sort(p,p+n,greater<int>());
ans = 0;
a = 0;
while(nk>=m){
for(int i=a;i<(a+... |
Problem: 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 bloom... | while True:
n, m = [int(i) for i in input().split()]
if n == 0 and m == 0:
break
p = [int(i) for i in input().split()]
p.sort()
p.reverse()
ans = 0
for i in range(len(p)):
if (i+1) % m > 0:
ans = ans + p[i]
print(ans)
|
Problem: 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 bloom... | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import itertools
import math
from collections import Counter, defaultdict
class Main(object):
def __init__(self):
pass
def solve(self):
'''
insert your code
'''
while True:
n, m = map(... |
Problem: 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 bloom... | #include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
int main(){
int n,m;
int yasai[1000];
int zenbu=0;
int c=0;
while(true){
cin>>n>>m;
if(n==0&&m==0)break;
for(int i=0;i<n;i++){
cin>>yasai[i];
}
sort(yasai,yasai+n,greater<int>());
for(int i=0;i<n;i++){
if(c==m-1)c=... |
Problem: 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 bloom... | #include <iostream>
#include <algorithm>
using namespace std;
int n,m,p[1000],ans;
int main(){
while(1){
ans=0;
cin>>n>>m;
if(n==0&&m==0) break;
for(int i=0;i<n;i++)cin>>p[i];
sort(p,p+n);
for(int i=n-1;i>=0;i--)
if((n-i)%m!=0)ans+=p[i];
cout<<ans<<endl;
}
return 0;
} |
Problem: 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 bloom... | #include <algorithm>
#include <deque>
#include <functional>
#include <iostream>
using namespace std;
int main() {
int n, m, j=0, x, min;
deque<int> p;
while(cin >> n >> m) {
if(n==0&&m==0)
break;
int a=m-1;
min=0;
p.clear();
for(int i=0; i<n; i++) {
cin >> x;
p.push_back(x);
}
sort(p.begin... |
Problem: 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 bloom... | #include<iostream>
#include<set>
using namespace std;
int main()
{
multiset< int,greater<int> > s;
multiset<int>::iterator it;
int n,m,p,i;
int cost;
while(cin>>n>>m,n||m){
s.clear();
for(i=0;i<n;i++){
cin>>p;
s.insert(p);
}
cost=0;
i=0;
for(it=s.begin();it!=s.end();it++){
if(++i==m) i=0;
... |
Problem: 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 bloom... | #include <iostream>
#include <algorithm>
using namespace std;
int main() {
int a,b,i,sum=0;
int c[10000];
while(1){
cin >> a >> b;
if(a==0 && b==0) break;
for(i=0;i<a;i++){
cin >> c[i];
sum+=c[i];
}
sort(c,c+a);
reverse(c,c+a);
for(i=b-1;i<a;i+=b){
sum-=c[i];
}
cout << sum << endl;
sum=... |
Problem: 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 bloom... | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void solve()
{
int n, m;
while(cin >> n >> m, n || m)
{
vector<int> Vec;
for(int i = 0; i < n; ++i)
{
int price;
cin >> price;
Vec.push_back(price);
}
sort(Vec.begin(), Vec.end());
int count = 1;
int sum = 0;
f... |
Problem: 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 bloom... |
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
new Main().run();
}
private void run() throws IOException {
Scanner scanner = new Scanner(System.in);
while (true) {
int n = scanner.nextInt();
... |
Problem: 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 bloom... | #include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
int main(){
int n,m; //問題文のn,m
while(std::cin >> n >> m){
if(n==0&&m==0) break;
std::vector<int> p(n); //野菜価格一覧
for(int i=0;i<n;++i){
std::cin >> p[i];
}
sort(p.begin(), p.end());
reverse(p.begin(), p.end()); //降順ソート
... |
Problem: 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 bloom... | while 1:
qua,bag = input().split()
qua = int(qua)
bag = int(bag)
if qua == 0:
break
price = list(map(int,input().split()))
price.sort(reverse=True)
for i in range(qua):
if (i+1)%bag == 0:
price[i]=-1
for i in range(qua//bag):
... |
Problem: 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 bloom... | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
int n,m;
while(cin>>n>>m,n||m){
int d[1000],sum=0;
for(int i=0;i<n;i++)cin>>d[i];
sort(d,d+n,greater<int>());
for(int i=0;i<n;i++){
if((i+1)%m!=0)sum+=d[i];
}
cout<<sum<<endl;
... |
Problem: 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 bloom... |
while True:
try:
num, size = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort(reverse = True)
for i in range(size-1, num, size):
arr[i] = 0
print(sum(arr))
except:
break
|
Problem: 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 bloom... | #include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <functional>
using namespace std;
#define pb push_back
int main()
{
int n,m;
while(1)
{
cin >> n >> m;
if(n == 0 && m == 0) return 0;
vector<int>vec;
for(int i=0;i<n;i++)
{
int x; cin >> x; vec.pb(x);
}
sort(vec.b... |
Problem: 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 bloom... | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m,sum=0,d;
int p[1100];
while(1){
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);
reverse(p,p+n);
/*for(int i=1; i<=n/m; i++) p[i*m-1]=0;
... |
Problem: 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 bloom... | #include <iostream>
#include <queue>
int main(){
int m,n;
while(std::cin >> n >> m){
//n,mがゼロで終了
if(n == 0 && m == 0){
break;
}
int sum_cost = 0;
std::priority_queue<int> vegetable;
for(int i = 0; i < n; ++i){
int cost;
std::cin >> cost;
vegetable.push(cost);
}
for(int i = 1; i <=... |
Problem: 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 bloom... | #include<stdio.h>
#include<algorithm>
#include<numeric>
int main()
{
int m,n,p[10000],i,d;
while(scanf("%d%d",&n,&m),m)
{
for(d=i=0;i<n;++i)scanf("%d",&p[i]);
std::sort(p,p+n);
for(i=n-m;i>=0;i-=m)d+=p[i];
printf("%d\n",std::accumulate(p,p+n,0)-d);
}
return 0;
} |
Problem: 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 bloom... | #include <bits/stdc++.h>
using namespace std;
bool solve(){
int n, m;
cin >> n >> m;
if(n == 0) return false;
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==0) continue;
ans +=... |
Problem: 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 bloom... | #include <iostream>
#include <vector>
#include <algorithm>
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 p; cin >> p;
v.push_back(p);
}
sort( v.begin(), v.end() );
reverse( v.begin(), v.end() );
int ans = 0, count = 0... |
Problem: 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 bloom... | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
int n,m;
while(cin>>n>>m&&n)
{
vector<int> a;
int ans=0;
for(int i=0;i<n;i++)
{
int x;
cin>>x;
a.push_back(x);
}
sort(a.begin(),a.end());
for(int i=0;i<n%m;i++)
{
ans+=a[0];;
a.erase(a.begin()... |
Problem: 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 bloom... | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
int ans=0;
int be[10002];
int x=-1,n,m;
while(1){
x=-1;
ans=0;
cin>>n>>m;
if(m==0&&n==0)break;
for(int i=0;i<n;i++){
cin>>be[i];
ans+=be[i];
}
sort(be,be+n,greater<int>());
while(n>=m){
x+=m... |
Problem: 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 bloom... | #include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int main(){
int i,n,m,a,price[1000],count,out;
while(cin >> n >> m && (n != 0 && m != 0)){
count = out = 0;
for(i = 0;i < n;i++){
cin >> a;
price[i] = a;
}
sort(price,price+n,greater<int>());
for(i = 0;i < n;i++){
... |
Problem: 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 bloom... | import java.util.*;
public class Main {
static Scanner sc = new Scanner(System.in);
static int n, m, p;
static int[] commodity;
public static void main(String[] args) {
while(read()){
solve();
}
}
static boolean read(){
n = sc.nextInt(); m = sc.nextInt();
if(n == 0 && m == 0)return false;
commodity =... |
Problem: 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 bloom... | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
while(true) {
int n = stdIn.nextInt();
int m = stdIn.nextInt();
if(n == 0 && m == 0) {
break;
}
int[] p = new int[n];
for(int i = 0; i < n; i++) {
p[i] = stdIn.nextIn... |
Problem: 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 bloom... | #include<cstdio>
#include<algorithm>
using namespace std;
int main(){
int n,m;
while(scanf("%d%d",&n,&m)){
if(n==0) break;
int x[1000],i,sum=0;
for(i=0;i<n;i++){
scanf("%d",&x[i]);
sum+=x[i];
}
sort(x,x+n);
for(i=n%m;i<n;i+=m){
sum-=x[i];
}
printf("%d\n",sum);
}
return 0;
} |
Problem: 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 bloom... | #include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <cfloat>
#include <map>
using namespace std;
int main(){
int n,m;
while(cin>>n>>m,n!=0||m!=0){
vector<int> a(n);
for(int i=0;i<n;i++)
cin>>a[i];
sort(a.begin(),a.end());
int s=0;
int ... |
Problem: 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 bloom... |
#include"iostream"
using namespace std;
int main() {
while (1) {
int n, m,p[10000],sum=0;
cin >> n >> m;
if (n == 0 && m == 0)break;
for (int i = 1; i <= n; i++) {
cin >> p[i];
}
for (int j = 0; j < n - 1; j++) {
for (int i = 1; i < n ; i++) {
if (p[i] < p[i + 1]) {
swap(p[i], p[i + 1])... |
Problem: 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 bloom... | #include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
int n,m,*b,ans;
int main(){
while(true){
cin >> n >> m;
if(!n && !m)
return 0;
b = new int[n];
ans = 0;
for(int i=0; i<n; i++)
cin >> b[i];
sort(b,b+n,greater<int>());
for(int i=1; i<=n; i++){
if(i%m == 0)
con... |
Problem: 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 bloom... | #include<iostream>
#include<algorithm>
#define MAX 1000;
using namespace std;
int main(){
int n,m,s;
while(cin >> n >> m){
int p[n];
if(n==0 || m==0) return 0;
for(int i=0; i<n; i++){
cin >> p[i];
}
int sum=0,ans=0, min;
sort(p, p+n, greater<int>());
for(int i=0; i<n; i+=m){... |
Problem: 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 bloom... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
while True:
n,m = map(int,input().split(" "))
if n == 0 and m == 0:
break
prices = list(map(int,input().split(" ")))
count = 0
cost = 0
for p in reversed(sorted(prices)):
count += 1
if count >= m:
count = 0
... |
Problem: 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 bloom... | #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> vegetable(n,0);
for(int i = 0; i < n; ++i){
std::cin >> vegetable[i];
}
std::sort(vegetable.begin(), vegetable.end(), std::greater<int>());
in... |
Problem: 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 bloom... | import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
Scanner in=new Scanner(System.in);
for(;;)
{
int n=in.nextInt();
int m=in.nextInt();
if((n|m)==0)
return;
ArrayList<Integer> ... |
Problem: 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 bloom... | while 1:
n, m = map(int, input().split())
if n == 0:
break
veg = list(map(int, input().split()))
veg.sort(reverse=True)
cnt = 0
ans = 0
while veg != []:
cnt += 1
tmp = veg.pop(0)
if cnt % m == 0:
pass
else:
ans += tmp
pri... |
Problem: 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 bloom... | #include <iostream>
#include <algorithm>
#include <vector>
int main(){
int n,m;
while(std::cin >> n >> m){
if(n == 0 && m == 0) return 0;
std::vector<int> a(n);
for(int i = 0; i < n; ++i){
std::cin >> a[i];
}
std::sort(a.begin(), a.end(), std::greater<int>());//降順
int cost = 0;
for(int i = ... |
Problem: 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 bloom... | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m,temp;
while(1){
cin >> n >> m;
int a[n+1],sum=0;
if(n==m && n==0) break;
for(int i=1;i<=n;i++){
cin >> a[i];
}
for(int i=1;i<n;i++){
for(int j=i+1;j<n+1;j++){
if(a[i]<a[j]){
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
... |
Problem: 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 bloom... | #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 + 1 );
for ( int i = 1; i <= n; i++ ) {
cin >> xs[ i ];
}
sort( x... |
Problem: 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 bloom... | #include<iostream>
#include<queue>
using namespace std;
int main(){
int n,m,sum,x;
while(cin>>n>>m,n||m){
sum=0;
priority_queue<int> que;
for(int i=0;i<n;i++){
cin>>x;
que.push(x);
}
for(int i=1;i<=n;i++){
if((m+i)%m!=0){
sum+=que.top();
}
que.pop();
}
cout<<sum<<endl;
}
return 0;... |
Problem: 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 bloom... | #include <bits/stdc++.h>
using namespace std;
int p[1010];
int main(){
while(1){
int n,m,t=0;
cin>>n>>m;
if(n==0&&m==0) break;
for(int i=0;i<n;i++) cin>>p[i];
int f=1;
while(f==1){
f=0;
for(int j=0;j<n-1;j++){
if(p[j]<p[j+1]){
swap(p[j],p[j+1]);
f=1;
}
}
}
for(int i=1;i<=n/... |
Problem: 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 bloom... | #include<algorithm>
#include<vector>
#include<iostream>
using namespace std;
vector<int> l;
int n,m;
bool input(){
cin>>n>>m;
if(n==m&&n==0)return false;
l.clear(),l.resize(n);
for(int i=0;i<n;i++){
cin>>l[i];
}
return true;
}
int solve(){
sort(l.rbegin(),l.rend());
int ans = 0;
for(int i=0;i<n... |
Problem: 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 bloom... | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
for(;;){
int n,m;
cin >> n >> m;
if(n == 0 || m == 0) break;
vector<int> v(n);
for(int i=0; i<n; i++){
cin >> v[i];
}
sort(v.rbegin(),v.rend());
int sum = 0;
for(int i=0; i<n; i++){
... |
Problem: 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 bloom... | #include <iostream>
#include <vector>
#include <algorithm>
int main(){
int num,cap,price;
while(std::cin >> num >> cap){
if(num == 0 && cap == 0){
break;
}
std::vector<int> vegetables;
for(int i=0; i<num; ++i){
std::cin >> price;
vegetables.push_back(price);
}
sort(vegetables.begin(), veget... |
Problem: 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 bloom... | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
vector<int>l;
int n, m;
while (cin >> n >> m){
if (n == 0 && m == 0)break;
int k[1001];
for (int i = 0; i < n; i++){
cin >> k[i];
}
sort(k, k + n);
int sum = 0;
for (int i = 0; i < n; i++)
if (n % m != i % m... |
Problem: 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 bloom... | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
int n,m;
while(1){
cin>>n>>m;
if(n==0 && m==0) break;
int array[n],sum=0;
for(int i=0;i<n;i++)
cin>>array[i];
sort(array,array+n);
reverse(array,array+n);
for(int i=0;i<n;i++){
if((i+1)%m==0) array[i]... |
Problem: 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 bloom... | #include <iostream>
#include <numeric>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
int n,m,t;
while(cin >> n >> m){
if((n|m) == 0) break;
vector<int> val;
int ret;
for(int i=0;i<n;i++){
cin >> t;
val.push_back(t);
}
sort(val.begin(), val.end(), greater<int>());
... |
Problem: 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 bloom... | #include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
int main(){
int n, m;
int p[1000];
while(1){
cin >> n >> m;
if(n == 0 && m == 0) break;
for(int i = 0;i < n;i++){
cin >> p[i];
}
int ans = 0;
sort(p, p + n, greater<int>());
for(int i = 0;i < n;i++){
if(i % m == m... |
Problem: 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 bloom... | import java.util.Arrays;
import java.util.Scanner;
//Thanksgiving
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(true){
int n = sc.nextInt();
int m = sc.nextInt();
if((n|m)==0)break;
int[] a = new int[n];
int s = 0;
for(int i=0;i<n;i++){
... |
Problem: 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 bloom... | #include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
int main(){
long n,m,i,p[10000],s;
while(cin>>n>>m){
if(n==0)break;
for(i=0;i<n;i++)cin>>p[i];
sort(p,p+n,greater<long>());
for(s=i=0;i<n;i++)if(i%m!=m-1)s+=p[i];
cout<<s<<endl;
}
return 0;
} |
Problem: 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 bloom... | while True:
N, M = [ int(_) for _ in raw_input().split() ]
if N == 0: break
p = [ int(_) for _ in raw_input().split() ]
p.sort()
p.reverse()
s = 0
for i in xrange(N):
if i % M != M - 1:
s += p[i]
print s
|
Problem: 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 bloom... | #include <iostream>
#include <algorithm>
using namespace std;
int n, m;
int p[1005];
int sum=0;
void solve(){
for(int i=0;i<n;i++){
cin >> p[i];
sum+=p[i];
}
sort(p,p+n);
reverse(p,p+n);
for(int i=m-1;i<n;i+=m){
sum-=p[i];
}
cout << sum << endl;
sum=0;
}
int main(){
while(cin >> n >> m)... |
Problem: 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 bloom... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
import static java.lang.Integer.parseInt;
/*
* Problem B: Thanksgiving
*/
public class Main {
public static void main(String[] args) throws IOException {
Buffer... |
Problem: 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 bloom... | 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
if amari > 0:
s = sum(yasai[0:amari])
i = 0
for y in yasai[amar... |
Problem: 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 bloom... | #include <stdio.h>
#include <algorithm>
int main(void)
{
int n;
int m;
int data[1000];
int ans;
while (1){
scanf("%d%d", &n, &m);
if (n == 0){
break;
}
for (int i = 0; i < n; i++){
scanf("%d", &data[i]);
}
std::sort(data, data + n);
std::reverse(data, data + n);
ans = 0;
for (in... |
Problem: 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 bloom... | 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];
for(int i = 0;i < n... |
Problem: 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 bloom... | while True:
n, m = map(int, input().split())
if n == 0:
break
price = sorted(map(int, input().split()), reverse=True)
print(sum(price) - sum(price[m - 1::m])) |
Problem: 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 bloom... | import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n, m;
int p[];
while (true) {
n = sc.nextInt();
m = sc.nextInt();
if ((n | m) == 0) {
break;
}
p = new int[n];
for (int i = 0; i < n... |
Problem: 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 bloom... | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int n,m, cost;
while( cin >> n >> m , n|m ){
int sum = 0;
vector<int> vc;
for(int i=0 ; i<n ; ++i){
cin >> cost;
vc.push_back( cost );
}
sort( vc.begin() , vc.end() );
reverse( vc.begin() , vc.end() );
fo... |
Problem: 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 bloom... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
while (cin >> n >> m && n) {
vector<int> p(n);
for (int i=0; i<n; ++i) {
cin >> p[i];
}
sort(p.begin(), p.end());
int res = accumulate(p.begin(), p.end(), 0);
for (int i=n%m... |
Problem: 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 bloom... | #include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <numeric>
using namespace std;
int main() {
int n, m;
while (cin >> n >> m && n) {
vector<int> p(n);
for (int i=0; i<n; ++i) {
cin >> p[i];
}
sort(p.begin(), p.en... |
Problem: 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 bloom... | import java.util.*;
public class Main {
Scanner sc = new Scanner(System.in);
private void doit() {
while (true) {
int n = sc.nextInt();
int m = sc.nextInt();
if((n|m) == 0) break;
int [] data = new int[n];
int sum = 0;
for(int i = 0; i < n; i++){
data[i] = sc.nextInt();
sum += data[i];
... |
Problem: 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 bloom... | #include <algorithm>
#include <iostream>
#include <numeric>
using namespace std;
int main() {
int n, m, cost;
int p[1000];
while (true) {
cin >> n >> m;
if (n == 0) {
return 0;
}
for (int i = 0; i < n; ++i) {
cin >> p[i];
}
sort(p, p + n);
cost = accumulate(p, p + n, 0);
... |
Problem: 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 bloom... | import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
for (;;) {
int n = sc.nextInt(), m = sc.nextInt();
if ((n | m) == 0) {
break;
}
int[] ... |
Problem: 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 bloom... | import java.util.*;
public class Main {
Scanner in = new Scanner(System.in);
public static void main(String[] args) {
new Main();
}
public Main() {
new AOJ0227();
}
class AOJ0227{
public AOJ0227() {
while(true){
int n = in.nextInt();//購入する野菜
int m = in.nextInt();//袋に入る野菜
if(n==0&&m==0)break... |
Problem: 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 bloom... | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,m;
while(true){
cin >>n>>m;
if(n==0){
break;
}
int p[n];
for(int i=0;i<n;i++){
cin >>p[i];
}
sort(p,p+n);
int mon=0;
for(int i=0;i<n;i++){
mon += p[i];
}
int wari = 0;
... |
Problem: 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 bloom... | #include<stdio.h>
#include<stdlib.h>
int comp(const void *a,const void *b){
return *(int*)b-*(int*)a;
}
int main(){
int n,m;
int p[1000];
int i,j;
int ans;
while(1){
scanf("%d %d",&n,&m);
if(n==0)return 0;
ans=0;
for(i=0;i<n;i++)scanf("%d",&p[i]);
qsort(p,n,sizeof(int),comp);
for(i=0;i<n;i++){
if(... |
Problem: 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 bloom... | #include <stdio.h>
#include <algorithm>
#pragma warning(disable : 4996)
using namespace std;
int n, m, 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);
int ret = 0;
for (int i = 0; i < n; i++) ret += p[i... |
Problem: 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 bloom... | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,m;
while(1){
cin>>n>>m;
if(!n&&!m)break;
priority_queue <int> Q;
for(int i=0,a;i<n;i++)cin>>a,Q.push(a);
int ans=0,cnt=0,sum=0;
while(!Q.empty()){
int t=Q.top();Q.pop();
cnt++;
sum+=t;
if(n&&cnt==m) ans+=sum-t,sum=cnt=0,n-... |
Problem: 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 bloom... | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
// your code goes here
int m,p,tmp;
while(cin >> m >> p && m!=0){
vector<int> v;
int sum=0;
for(int i=0;i<m;i++){
cin >> tmp;
v.push_back(tmp);
}
sort(v.begin(),v.end());
int mods=m%p;
... |
Problem: 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 bloom... | #include <cstdio>
#include <algorithm>
using namespace std;
static const int MAX_N = 1001;
int vegs[MAX_N];
int main()
{
int n, m, sum;
for (; ; ) {
scanf("%d %d", &n, &m);
if (n == 0 && m == 0) break;
sum = 0;
for (int i = 0; i < n; i++) scanf("%d", &vegs[i]);
sort(vegs... |
Problem: 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 bloom... | while True:
try:
num, size = map(int, raw_input().split())
arr = map(int, raw_input().split())
arr.sort(reverse = True)
for i in range(size-1, num, size):
arr[i] = 0
print sum(arr)
except:
break
|
Problem: 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 bloom... | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
int n,m;
int p[11111];
int sum;
while(1){
cin>>n>>m;
sum=0;
if(n+m==0) break;
for(int i=0;i<n;i++){
cin>>p[i];
}
sort(p,p+n,greater<int>());
for(int i=0;i<n;i++){
sum=sum+p[i];
if((i+1)%m==0){
... |
Problem: 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 bloom... | #include<iostream>
#include<algorithm>
#include<functional>
#include<numeric>
using namespace std;
int main(){
int n,m;
int p[1000];
while(cin>>n>>m,n|m){
for(int i=0;i<n;i++)cin>>p[i];
sort(p,p+n,greater<int>());
int s=accumulate( p,p+n, 0 );
for(int i=m-1;i<n;i+=m){
s-=p[i];
}
cout<<s<<endl;
}
r... |
Problem: 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 bloom... | while 1:
try:
nm = map(int, raw_input().split())
if nm == [0, 0]:
break
n = nm[0]
m = nm[1]
p = map(int, raw_input().split())
p_sorted = sorted(p)
sum = 0
for i in range(n):
if (i+1) % m != 0:
sum += p_sorted[-1-... |
Problem: 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 bloom... | while 1:
_,m=map(int, input().split())
if m==0:break
p=sorted(map(int,input().split()),reverse=1)
print(sum(p)-sum(p[m-1::m])) |
Problem: 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 bloom... | import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
public class Main{
Scanner sc=new Scanner(System.in);
int INF=1<<28;
double EPS=1e-9;
void run(){
for(;;){
int n=sc.nextInt();
int m=sc.nextInt();
if((n|m)=... |
Problem: 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 bloom... |
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner sn = new Scanner(System.in);
while(true){
int n = sn.nextInt();
int m = sn.nextInt();
if(n == 0 && m == 0) break;
ArrayList<Integer> vegies = new Ar... |
Problem: 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 bloom... | import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner sc =new Scanner(System.in);
for(;;){
int n=sc.nextInt(),m=sc.nextInt();
if(m==0)break;
int ans=0;
int []in=new int[n];
int []bezi=new int[n+1];
for(int i=0; i<n;i++)in[i]=sc.nextInt();
Arrays.sort(in);
for(int i=n... |
Problem: 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 bloom... | #include <iostream>
#include <algorithm>
using namespace std;
int main(void){
int n,m;
while(cin>>n>>m,n){
int t[n];
for(int i=0;i<n;i++){
cin>>t[i];
}
sort(t,t+n);
reverse(t,t+n);
int ans = 0;
for(int i=0;i<n;i+=m){
int sum = 0;
for(int j=i;j<n && j<i+m;j++){
sum += t[j];
}
if(i+m... |
Problem: 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 bloom... | #include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n, m;
long long p[1000];
while(1) {
cin >> n >> m;
if (n == 0 && m == 0) break;
long long ans = 0;
for (int i = 0; i < n; i++) {
cin >> p[i];
ans += p[i];
}
sort(p, p+n, std::greater<long long>()... |
Problem: 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 bloom... | #include<iostream>
#include<algorithm>
using namespace std;
int main() {
int n, m;
while (cin >> n >> m, n, m) {
int p[1000];
int sum = 0;
for (int i = 0;i < n;i++) {
cin >> p[i];
sum += p[i];
}
sort(p, p+ n);
reverse(p, p + n);
for (int i = m - 1;i < n;i += m) {
sum -= p[i];
}
cout <<... |
Problem: 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 bloom... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class Main{
public static void main(String[] args) {
BufferedReader input = new BufferedReader(new In... |
Problem: 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 bloom... | #include <cstdio>
#include <algorithm>
#include <functional>
using namespace std;
int ps[1000];
int main(){
int n,m;
for(;;){
scanf("%d%d",&n,&m);
if(n==0&&m==0) break;
for(int i=0;i<n;i++){
scanf("%d",&ps[i]);
}
sort(ps,ps+n,greater<int>());
int sum=0... |
Problem: 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 bloom... | #include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int n,m,total,c;
int p[10000];
while(scanf("%d%d",&n,&m) && n != 0 && m != 0){
for(int i = 0; i < n; i++){
scanf("%d",&p[i]);
}
sort(&p[0],&p[n-1]+1);
c = total = 0;
for(int i = n-1; i >= 0; i--){
c++;
... |
Problem: 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 bloom... | for i in range(1, 101):
count = 0
temp = 0
SetCount = 0
try:
str1 = input()
list1 = str1.split(" ")
str2 = input()
list2 = str2.split(" ")
list2.sort(key=int, reverse=True)
for m in range(0, int(list1[0])):
if (m+1) % int(list1[1]) == 0:
... |
Problem: 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 bloom... | import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
while (true) {
int n = sc.nextInt();
int m = sc.nextInt();
if ((n | m) == 0)
break;
Integer[] ps = new ... |
Problem: 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 bloom... | #include <iostream>
#include <algorithm>
using namespace std;
int main(){
int n,m;
while(1){
cin >> n >> m;
if(n == 0 && m==0) break;
int item[1010];
for(int i=0;i<n;i++){
cin >> item[i];
}
sort(item,item+n);
int ans=0,f=1;
for(int i=n-1;i>=0;i--){
if(f==m){
f=1;
... |
Problem: 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 bloom... | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m,i,j;
int p[1001];
int sum;
while(1){
cin>>n>>m;
if(n==0&&m==0) break;
for(i=0;i<n;++i) cin>>p[i];
sort(p,p+n);
sum=0;
if(n%m==0){
for(i=0;i<n;i+=m)
for(j=1;j<m;++j)
sum+=p[i+j];
}else{
for(i=0;i<n%m;++i)... |
Problem: 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 bloom... | import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(true) {
int n = sc.nextInt();
int m = sc.nextInt();
if (n == 0) {
break;
}
int[] p = new int[n];
for(int i=0;i<n;i++) {
p[i] = sc.ne... |
Problem: 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 bloom... | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int n,m;
void solve()
{
vector<int> veg(n);
int ans = 0;
for(int i = 0; i < n; i++)
cin >> veg[i];
sort(veg.begin(), veg.end() );
for(int i = 1; i <= n; i++){
int d = veg.back();
veg.pop_back();
if(i % m)
ans += d;
}
... |
Problem: 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 bloom... | #include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
while (1) {
int a,b;
cin >> a>>b;
if (a == 0&&b==0)break;
vector<int>s(a);
for (int c = 0; c < a; c++) {
cin >> s[c];
}
sort(s.begin(), s.end());
int goukei = 0;
for (int e = 0; e < a; e++) ... |
Problem: 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 bloom... | #include<iostream>
#include<algorithm>
using namespace std;
int a[1000],n,m,ans;
int main(){
while(true){cin>>n>>m;if(n==0&&m==0)break;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<n;i+=m)ans-=a[i];cout<<ans<<endl;}
return 0;
} |
Problem: 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 bloom... | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M;
while (cin >> N >> M, N || M) {
vector<int> v(N);
for (auto& i : v) cin >> i;
sort(v.begin(), v.end());
int ans = 0;
for (int i = 1; i <= N; i++) {
if (i % M) ans += v[N - i];
}
... |
Problem: 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 bloom... | #include<iostream>
#include<algorithm>
using namespace std;
#define MAX 1000
int main(){
int n, m, P[MAX], sum;
while(1){
cin >> n >> m;
if ( n == 0 && m == 0 ) break;
sum = 0;
for ( int i = 0; i < n; i++ ) {
cin >> P[i];
sum += P[i];
}
sort(P, P+n, greater<int>());
for ( int i = m-1; i < n; i... |
Problem: 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 bloom... | #include<iostream>
#include<algorithm>
#include<functional>
#include<vector>
using namespace std;
vector<int> price;
int main(){
int n,m;
int ans;
int i;
while( cin >> n >> m )
{
if( n == 0 && m == 0 )
break;
ans = 0;
price.resize( n );
for( i = 0;i < n;i++ ){
cin >> price[i];
ans += price[i];
... |
Problem: 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 bloom... | #include <cstdio>
#include <algorithm>
#include <functional>
using namespace std;
int n, m, p[1000];
int main(){
for(; scanf("%d%d", &n, &m), n||m;){
for(int x = 0; x < n; x++){
scanf("%d", p+x);
}
sort(p, p+n, greater<int>());
int ans = 0, z;
for(int x = 0; x <... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.