Go: package main

import (
	"fmt"
	"math"
)

func main() {
	var M, N, P int
	for {
		fmt.Scan(&N, &M, &P)
		if N == 0 && M == 0 && P == 0 {
			return
		}

		arr := make([]int, N)
		sum := 0
		for i := 0; i < N; i++ {
			var po int
			fmt.Scan(&po)
			arr[i] = po
			sum += po
		}

		if arr[M-1] == 0 {
			fmt.Println(0)
		} else {
			fmt.Println(math.Floor(float64(sum * (100 - P) / arr[M-1])))
		}
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 10007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { 1, -1, 0, 0,  1, -1,  1, -1 };
static const int dy[] = { 0, 0, 1, -1 , 1,  1, -1, -1 };
static const char Move[] = { 'E', 'W', 'N', 'S' };

int N, M, P, ans;
double Return = 0;
VI X;

int main() {
	while ( ~scanf( "%d %d %d", &N, &M, &P ) && N && M && P ) {
		X.resize( N );
		for ( int i = 0; i < N; i++ ) {
			scanf( "%d", &X[ i ] );
			Return += X[ i ] * 100;
		}
		Return -= P * 0.01 * Return;
		if ( X[ M - 1 ] ) {
			Return /= X[ M - 1 ];
		}
		else {
			Return = 0;
		}
		ans = Return;
		Return = 0;
		printf( "%d\n", ans );
	}
	return 0;
}

C++: #include <cstdio>
using namespace std;

int main(void){
	int N, M, P;
	while(scanf("%d %d %d", &N, &M, &P) != EOF && (N != 0 && M != 0 && P != 0)){
		int sum = 0;
		int *X = new int[N];
		for(int i = 0; i < N; i++){
			scanf("%d", X+i);
			sum += X[i];
		}
		if(X[M-1] == 0){
			printf("%s\n", "0");
		}else{
			printf("%d\n", (int)((sum * (100 - P)) / X[M-1]));
		}
	}
  return 0;
}

C++: #include <cstdio>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
	while(true){
		int n,m,p,all=0,y=-1;
		scanf("%d%d%d",&n,&m,&p);
		if(n==0) break;
		rep(i,n){
			int x;
			scanf("%d",&x);
			if(i+1==m) y=x;
			all+=x*100;
		}
		if(y==0){
			printf("0\n");
			continue;
		}
		printf("%d\n",all*(100-p)/100/y);
	}
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int N, M, P;
int X[110], sum;

void solve() {
	if (X[M] == 0) {
		cout << 0 << endl;
		return;
	}
	
	int sub = sum;
	sub *= P;
	sub /= 100;
	sum -= sub;
	
	cout << sum / X[M] << endl;
}

int main() {
	while (1) {
		cin >> N >> M >> P; if (N == 0 && M == 0 && P == 0) break;
		M--;
		
		sum = 0;
		for (int i = 0; i < N; i++) {
			cin >> X[i];
			sum += 100 * X[i];
		}
		
		solve();
	}
	
	return 0;
}

C++: #include <iostream>
#include <vector>
using namespace std;

int main(void){
  int N, M, P;
  while(cin >> N >> M >> P, N || M || P){
    float money_sum = 0;
    vector<int> ticket_number;
    for(int i=0; i < N; i++){
      int tmp; cin >> tmp;
      ticket_number.push_back(tmp);
    }

    for(int i=0; i < N; i++){
      money_sum += ticket_number[i] * 100;
    }

    money_sum = money_sum * ((100 - (float)P) / 100);
    if(ticket_number[M-1] == 0){
      cout << 0 << endl; continue;
    }

    cout << int(money_sum / ticket_number[M-1]) << endl;

  }
  return 0;
}

C++: #include<stdio.h>

int main(){

int N,M,P;
while(1){

scanf("%d %d %d",&N,&M,&P);
if(N==0&&M==0&&P==0)break;

int x,s=0,y=0;
for(int i=0;i<N;i++){
scanf("%d",&x);s+=x;
if(M==i-1)y=x;

}

printf("%d\n",(y/s*(100-P)/100));
}
return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main(){
	int n, m, p;
	while(cin >> n >> m >> p, n || m || p){
		vector<int> x(n);
		int bet = 0;
		
		for(int i = 0; i < n; i++){//input
			cin >> x[i];
			bet += x[i];
		}

		bet = bet * p;
		if(x[m-1] == 0){
			bet = 0;
		}else{
			bet = bet/x[m-1];
		}
		cout << bet << endl;
	}

	return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;

int main(){
	int n, m, p, ans;
	while(1){
		cin >> n >> m >> p;
		if(n == 0 && m == 0 && p == 0) break;

		ans = 0;
		for(int i = 1; i <= n; i++){
			int x;
			cin >> x;
			ans += x;
			if(i == m) m = x;
		}

		
		ans = ans * (100-p);
		if(m == 0){
			ans = 0;
		}else{
			ans = ans / m;
		}
		
		cout << ans << endl;
	}

	return 0;
}

C++: #include<iostream>
using namespace std;

int main(){
  int i,n,m,p,x[1001],total;


  while(1){
         
    total = 0;
    cin >> n >> m >> p;
    if(n==0 && m==0 && p==0)break;

    for( i = 1; i <=1000; i++){
      x[i]=0;
    }

    for( i = 1; i <= n; i++){
      cin >> x[i];
      total += x[i]*100;
    }
      
    if(x[m]>0){
      total = total * (100- p) /100;
      total /= x[m];
      cout << total << endl;
    }else if(x[m]==0){
      cout << 0 << endl;
    }
  }
  return 0;
}

C++: #include <iostream>
#include <vector>
using namespace std;

/*掛け金の合計を求める*/
int Sum(const int* X, int size) {
  int sum = 0;
  for(int i = 0; i < size; i++) {
    sum += X[i];
  }
  return sum;
}

/*当選者に分配(比例)*/
int Devide(int d, const int *X, int M) {
  if(X[M] != 0) 
    return (int)(d / X[M]);
  else
    return 0;
}

int main() {
  int N; //競技者の数
  int M; //優勝者の番号
  int P; //控除率(百分率)
  vector<int> X; //掛け金
  int deduction; //掛け金-控除率

  while(1) {
    cin >> N >> M >> P;
    if(N == 0 && M == 0 && P == 0)
      break;
      
    for(int i = 0; i < N; i++) {
      int x;
      cin >> x;
      X.push_back(x);
    }
    
    deduction = Sum(&X.front(), X.size()) * (100-P); /*掛け金-控除率を求める*/
    cout << Devide(deduction, &X.front(), M-1) << endl;
    X.clear();
  }

}

C++: #include<iostream>
using namespace std;

int main(){
  int N,M,P,X[100],sum=0;
  
  while(1){
    sum=0;
    cin >> N >> M >> P;
    
    if(N==0 && M==0 && P==0){
      break;
    }
    
    for(int i=0;i<N;i++){
      cin >> X[i];
      sum+=X[i];
    }

    if(X[M-1]==0){
      cout << 0 << endl;
      continue;
    }

    cout << (int)((double)sum*((double)(100.0-(double)P))/(double)X[M-1]) << endl;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int N, M, P;
	while( 1 ){
		cin >> N >> M >> P;
		if( N == 0 && M == 0 && P == 0 ) break;
		int money = 0, mn;
		for( int i = 1; i <= N; i++ ){
			int j;
			cin >> j;
			if(M == i) mn = j;
			money += j;
		}
		if( mn == 0 ){
			cout << 0 << endl;
		}else{
			money = money * (100 - P) / mn;
			cout << money << endl;
		}
	}
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int N, M, P;
    while (cin >> N >> M >> P && (N || M || P)) {
        vector<int> X(N);
        for (int i=0; i<N; ++i) {
            cin >> X[i];
        }
        if (X[M-1] == 0) {
            cout << 0 << endl;
        } else {
            int ret = accumulate(X.begin(), X.end(), 0) * 100 * (1.0 - P / 100.0) / X[M-1] + 1e-9;
            cout << ret << endl;
        }
    }
    return 0;
}